下面列出了java.util.jar.Pack200#Unpacker ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
private static void unpack0(File inFile, JarOutputStream jarStream,
boolean useJavaUnpack) throws IOException {
// Unpack the files
Pack200.Unpacker unpacker = Pack200.newUnpacker();
Map<String, String> props = unpacker.properties();
if (useJavaUnpack) {
props.put("com.sun.java.util.jar.pack.disable.native", "true");
}
// Call the unpacker
unpacker.unpack(inFile, jarStream);
}
/**
* Converts any pack files in a directory into standard JAR files. Each
* pack file will be deleted after being converted to a JAR. If no
* pack files are found, this method does nothing.
*
* @param libDir the directory containing pack files.
* @param printStatus true if status ellipses should be printed when unpacking.
*/
private void unpackArchives(File libDir, boolean printStatus) {
// Get a list of all packed files in the lib directory.
File[] packedFiles = libDir.listFiles( ( dir, name ) -> {
return name.endsWith(".pack");
} );
if (packedFiles == null) {
// Do nothing since no .pack files were found
return;
}
// Unpack each.
boolean unpacked = false;
for (File packedFile : packedFiles) {
try {
String jarName = packedFile.getName().substring(0,
packedFile.getName().length() - ".pack".length());
// Delete JAR file with same name if it exists (could be due to upgrade
// from old Wildfire release).
File jarFile = new File(libDir, jarName);
if (jarFile.exists()) {
jarFile.delete();
}
InputStream in = new BufferedInputStream(new FileInputStream(packedFile));
JarOutputStream out = new JarOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(libDir, jarName))));
Pack200.Unpacker unpacker = Pack200.newUnpacker();
// Print something so the user knows something is happening.
if (printStatus) {
System.out.print(".");
}
// Call the unpacker
unpacker.unpack(in, out);
in.close();
out.close();
packedFile.delete();
unpacked = true;
}
catch (Exception e) {
e.printStackTrace();
}
}
// Print newline if unpacking happened.
if (unpacked && printStatus) {
System.out.println();
}
}