Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.sevenz

pack-priv abstract Class AbstractCoder

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.compress.archivers.sevenz.AES256SHA256Decoder, org.apache.commons.compress.archivers.sevenz.Coders.BCJDecoder, org.apache.commons.compress.archivers.sevenz.Coders.BZIP2Decoder, org.apache.commons.compress.archivers.sevenz.Coders.CopyDecoder, org.apache.commons.compress.archivers.sevenz.Coders.Deflate64Decoder, org.apache.commons.compress.archivers.sevenz.Coders.DeflateDecoder, org.apache.commons.compress.archivers.sevenz.DeltaDecoder, org.apache.commons.compress.archivers.sevenz.LZMA2Decoder, org.apache.commons.compress.archivers.sevenz.LZMADecoder
Imports
java.io.IOException, .InputStream, .OutputStream, java.util.Objects, java.util.stream.Stream, org.apache.commons.compress.utils.ByteUtils

Abstracts a base Codec class.

Field Summary

Modifier and TypeField and Description
private final Class<?>[]

Constructor Summary

AccessConstructor and Description
protected
AbstractCoder(final Class<?>...
types that can be used as options for this codec.
optionClasses
)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract InputStream

Returns:

a stream that reads from in using the configured coder and password.
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.

pack-priv OutputStream

Returns:

a stream that writes to out using the given configuration.
encode
(final OutputStream out, final Object options)

Encodes using a stream that writes to out using the given configuration.

pack-priv byte[]

Returns:

property bytes to write in a Folder block.
getOptionsAsProperties
(final Object options)

Gets property bytes to write in a Folder block.

pack-priv Object

Returns:

configuration options that have been used to create the given InputStream from the given Coder
getOptionsFromCoder
(final Coder coder, final InputStream in)

Gets configuration options that have been used to create the given InputStream from the given Coder.

pack-priv boolean

Returns:

whether this method can extract options from the given object.
isOptionInstance
(final Object opts)

Tests whether this method can extract options from the given object.

protected static int

Returns:

The given number or default value.
toInt
(final Object
A Number.
options
,
final int
A default value if options is not a number.
defaultValue
)

If the option represents a number, return its integer value, otherwise return the given default value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

optionClassesback to summary
private final Class<?>[] optionClasses

Constructor Detail

AbstractCoderback to summary
protected AbstractCoder(final Class<?>... optionClasses)

Constructs a new instance.

Parameters
optionClasses:Class<?>[]

types that can be used as options for this codec.

Method Detail

decodeback to summary
pack-priv 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:InputStream

a stream that reads from in using the configured coder and password.

encodeback to summary
pack-priv OutputStream encode(final OutputStream out, final Object options) throws IOException

Encodes using a stream that writes to out using the given configuration.

Returns:OutputStream

a stream that writes to out using the given configuration.

Exceptions
IOException:
Optionally thrown by subclassses.
getOptionsAsPropertiesback to summary
pack-priv byte[] getOptionsAsProperties(final Object options) throws IOException

Gets property bytes to write in a Folder block.

Returns:byte[]

property bytes to write in a Folder block.

Exceptions
IOException:
Optionally thrown by subclassses.
getOptionsFromCoderback to summary
pack-priv Object getOptionsFromCoder(final Coder coder, final InputStream in) throws IOException

Gets configuration options that have been used to create the given InputStream from the given Coder.

Returns:Object

configuration options that have been used to create the given InputStream from the given Coder

Exceptions
IOException:
Optionally thrown by subclassses.
isOptionInstanceback to summary
pack-priv boolean isOptionInstance(final Object opts)

Tests whether this method can extract options from the given object.

Returns:boolean

whether this method can extract options from the given object.

toIntback to summary
protected static int toInt(final Object options, final int defaultValue)

If the option represents a number, return its integer value, otherwise return the given default value.

Parameters
options:Object

A Number.

defaultValue:int

A default value if options is not a number.

Returns:int

The given number or default value.