Class AbstractCoder
- java.lang.Object
-
- org.apache.commons.compress.archivers.sevenz.AbstractCoder
-
- Direct Known Subclasses:
AES256SHA256Decoder,Coders.BCJDecoder,Coders.BZIP2Decoder,Coders.CopyDecoder,Coders.Deflate64Decoder,Coders.DeflateDecoder,DeltaDecoder,LZMA2Decoder,LZMADecoder
abstract class AbstractCoder extends java.lang.ObjectAbstracts a base Codec class.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>[]optionClasses
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCoder(java.lang.Class<?>... optionClasses)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract java.io.InputStreamdecode(java.lang.String archiveName, java.io.InputStream in, long uncompressedLength, Coder coder, byte[] password, int maxMemoryLimitInKb)Decodes using stream that reads from in using the configured coder and password.(package private) java.io.OutputStreamencode(java.io.OutputStream out, java.lang.Object options)Encodes using a stream that writes to out using the given configuration.(package private) byte[]getOptionsAsProperties(java.lang.Object options)Gets property bytes to write in a Folder block.(package private) java.lang.ObjectgetOptionsFromCoder(Coder coder, java.io.InputStream in)Gets configuration options that have been used to create the given InputStream from the given Coder.(package private) booleanisOptionInstance(java.lang.Object opts)Tests whether this method can extract options from the given object.protected static inttoInt(java.lang.Object options, int defaultValue)If the option represents a number, return its integer value, otherwise return the given default value.
-
-
-
Method Detail
-
toInt
protected static int toInt(java.lang.Object options, int defaultValue)If the option represents a number, return its integer value, otherwise return the given default value.- Parameters:
options- A Number.defaultValue- A default value if options is not a number.- Returns:
- The given number or default value.
-
decode
abstract java.io.InputStream decode(java.lang.String archiveName, java.io.InputStream in, long uncompressedLength, Coder coder, byte[] password, int maxMemoryLimitInKb) throws java.io.IOExceptionDecodes using stream that reads from in using the configured coder and password.- Returns:
- a stream that reads from in using the configured coder and password.
- Throws:
java.io.IOException
-
encode
java.io.OutputStream encode(java.io.OutputStream out, java.lang.Object options) throws java.io.IOExceptionEncodes using a stream that writes to out using the given configuration.- Returns:
- a stream that writes to out using the given configuration.
- Throws:
java.io.IOException- Optionally thrown by subclassses.
-
getOptionsAsProperties
byte[] getOptionsAsProperties(java.lang.Object options) throws java.io.IOExceptionGets property bytes to write in a Folder block.- Returns:
- property bytes to write in a Folder block.
- Throws:
java.io.IOException- Optionally thrown by subclassses.
-
getOptionsFromCoder
java.lang.Object getOptionsFromCoder(Coder coder, java.io.InputStream in) throws java.io.IOException
Gets configuration options that have been used to create the given InputStream from the given Coder.- Returns:
- configuration options that have been used to create the given InputStream from the given Coder
- Throws:
java.io.IOException- Optionally thrown by subclassses.
-
isOptionInstance
boolean isOptionInstance(java.lang.Object opts)
Tests whether this method can extract options from the given object.- Returns:
- whether this method can extract options from the given object.
-
-