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
Abstracts a base Codec class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCoder
(Class<?>... optionClasses) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescription(package private) abstract InputStream
decode
(String archiveName, 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) OutputStream
encode
(OutputStream out, Object options) Encodes using a stream that writes to out using the given configuration.(package private) byte[]
getOptionsAsProperties
(Object options) Gets property bytes to write in a Folder block.(package private) Object
getOptionsFromCoder
(Coder coder, InputStream in) Gets configuration options that have been used to create the given InputStream from the given Coder.(package private) boolean
isOptionInstance
(Object opts) Tests whether this method can extract options from the given object.protected static int
If the option represents a number, return its integer value, otherwise return the given default value.
-
Field Details
-
optionClasses
-
-
Constructor Details
-
AbstractCoder
Constructs a new instance.- Parameters:
optionClasses
- types that can be used as options for this codec.
-
-
Method Details
-
toInt
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 InputStream decode(String archiveName, InputStream in, long uncompressedLength, Coder coder, byte[] password, int maxMemoryLimitInKb) throws IOException Decodes 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:
IOException
-
encode
Encodes using a stream that writes to out using the given configuration.- Returns:
- a stream that writes to out using the given configuration.
- Throws:
IOException
- Optionally thrown by subclassses.
-
getOptionsAsProperties
Gets property bytes to write in a Folder block.- Returns:
- property bytes to write in a Folder block.
- Throws:
IOException
- Optionally thrown by subclassses.
-
getOptionsFromCoder
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:
IOException
- Optionally thrown by subclassses.
-
isOptionInstance
Tests whether this method can extract options from the given object.- Returns:
- whether this method can extract options from the given object.
-