Class Archive
java.lang.Object
org.apache.commons.compress.harmony.unpack200.Archive
Archive 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. Then
unpack() is called, to unpack the pack200 archive.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate booleanprivate final Pathprivate final longprivate org.apache.commons.io.input.BoundedInputStreamprivate FileOutputStreamprivate intprivate static final int[]private final Stringprivate final JarOutputStreamprivate booleanprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionArchive(InputStream inputStream, JarOutputStream outputStream) Creates an Archive with streams for the input and output files.Creates an Archive with the given input and output file names. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanavailable(InputStream inputStream) voidsetDeflateHint(boolean deflateHint) Sets the default hint.voidsetLogFile(String logFileName) Sets the lgg file.voidsetLogFile(String logFileName, boolean append) Sets the lgg file.voidsetQuiet(boolean quiet) Sets whether to set the log level to quiet.voidsetRemovePackFile(boolean removePackFile) If removePackFile is set to true, the input file is deleted after unpacking.voidsetVerbose(boolean verbose) Sets whether to set the log level to verbose.voidunpack()Unpacks the Archive from the input file to the output file.
-
Field Details
-
MAGIC
private static final int[] MAGIC -
inputStream
private org.apache.commons.io.input.BoundedInputStream inputStream -
outputStream
-
removePackFile
private boolean removePackFile -
logLevel
private int logLevel -
logFile
-
overrideDeflateHint
private boolean overrideDeflateHint -
deflateHint
private boolean deflateHint -
inputPath
-
inputSize
private final long inputSize -
outputFileName
-
closeStreams
private final boolean closeStreams
-
-
Constructor Details
-
Archive
Creates 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:
IOException- if an I/O error occurs
-
Archive
public Archive(String inputFileName, String outputFileName) throws FileNotFoundException, IOException Creates an Archive with the given input and output file names.- Parameters:
inputFileName- the input file name.outputFileName- the output file name- Throws:
FileNotFoundException- if the input file does not existIOException- if an I/O error occurs
-
-
Method Details
-
available
- Throws:
IOException
-
setDeflateHint
public void setDeflateHint(boolean deflateHint) Sets the default hint.- Parameters:
deflateHint- the hint value.
-
setLogFile
Sets the lgg file.- Parameters:
logFileName- the log file name.- Throws:
FileNotFoundException- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
-
setLogFile
Sets the lgg file.- Parameters:
logFileName- the log file name.append- iftrue, then bytes will be written to the end of the file rather than the beginning- Throws:
FileNotFoundException- if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
-
setQuiet
public void setQuiet(boolean quiet) Sets whether to set the log level to quiet.- Parameters:
quiet- whether to set the log level to 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) Sets whether to set the log level to verbose.- Parameters:
verbose- whether to set the log level to verbose.
-
unpack
Unpacks the Archive from the input file to the output file.- Throws:
Pack200Exception- Never thrown.IOException- if an I/O error has occurred.
-