- java.lang.Object
-
- kala.compress.harmony.unpack200.Archive
-
public class Archive extends java.lang.ObjectArchive is the main entry point to unpack200. An archive is constructed with either two file names, a pack file and an output file name or an input stream and an output streams. Thenunpack()is called, to unpack the pack200 archive.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancloseStreamsprivate booleandeflateHintprivate java.nio.file.PathinputPathprivate longinputSizeprivate BoundedInputStreaminputStreamprivate java.io.FileOutputStreamlogFileprivate intlogLevelprivate static int[]MAGICprivate java.lang.StringoutputFileNameprivate java.util.jar.JarOutputStreamoutputStreamprivate booleanoverrideDeflateHintprivate booleanremovePackFile
-
Constructor Summary
Constructors Constructor Description Archive(java.io.InputStream inputStream, java.util.jar.JarOutputStream outputStream)Creates an Archive with streams for the input and output files.Archive(java.lang.String inputFileName, java.lang.String outputFileName)Creates an Archive with the given input and output file names.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanavailable(java.io.InputStream inputStream)voidsetDeflateHint(boolean deflateHint)voidsetLogFile(java.lang.String logFileName)voidsetLogFile(java.lang.String logFileName, boolean append)voidsetQuiet(boolean quiet)voidsetRemovePackFile(boolean removePackFile)If removePackFile is set to true, the input file is deleted after unpacking.voidsetVerbose(boolean verbose)voidunpack()Unpacks the Archive from the input file to the output file
-
-
-
Field Detail
-
MAGIC
private static final int[] MAGIC
-
inputStream
private BoundedInputStream inputStream
-
outputStream
private final java.util.jar.JarOutputStream outputStream
-
removePackFile
private boolean removePackFile
-
logLevel
private int logLevel
-
logFile
private java.io.FileOutputStream logFile
-
overrideDeflateHint
private boolean overrideDeflateHint
-
deflateHint
private boolean deflateHint
-
inputPath
private final java.nio.file.Path inputPath
-
inputSize
private final long inputSize
-
outputFileName
private final java.lang.String outputFileName
-
closeStreams
private final boolean closeStreams
-
-
Constructor Detail
-
Archive
public Archive(java.io.InputStream inputStream, java.util.jar.JarOutputStream outputStream) throws java.io.IOExceptionCreates an Archive with streams for the input and output files. Note: If you use this method then callingsetRemovePackFile(boolean)will have no effect.- Parameters:
inputStream- the input stream, preferably aBoundedInputStream. The bound can the the file size.outputStream- the JAR output stream.- Throws:
java.io.IOException- if an I/O error occurs
-
Archive
public Archive(java.lang.String inputFileName, java.lang.String outputFileName) throws java.io.FileNotFoundException, java.io.IOExceptionCreates an Archive with the given input and output file names.- Parameters:
inputFileName- the input file name.outputFileName- the output file name- Throws:
java.io.FileNotFoundException- if the input file does not existjava.io.IOException- if an I/O error occurs
-
-
Method Detail
-
available
private boolean available(java.io.InputStream inputStream) throws java.io.IOException- Throws:
java.io.IOException
-
setDeflateHint
public void setDeflateHint(boolean deflateHint)
-
setLogFile
public void setLogFile(java.lang.String logFileName) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
setLogFile
public void setLogFile(java.lang.String logFileName, boolean append) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
setQuiet
public void setQuiet(boolean quiet)
-
setRemovePackFile
public void setRemovePackFile(boolean removePackFile)
If removePackFile is set to true, the input file is deleted after unpacking.- Parameters:
removePackFile- If true, the input file is deleted after unpacking.
-
setVerbose
public void setVerbose(boolean verbose)
-
unpack
public void unpack() throws Pack200Exception, java.io.IOExceptionUnpacks the Archive from the input file to the output file- Throws:
Pack200Exception- TODOjava.io.IOException- TODO
-
-