Class BaseEncoderInputStream
java.lang.Object
java.io.InputStream
org.refcodes.codec.BaseEncoderInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
The
BaseEncoderInputStream encodes data read from an underlying
InputStream using the configured BaseMetrics.
Decoded bytes are read lazily from the wrapped input stream and passed to a
BaseEncoder. The bytes emitted by the encoder are buffered internally
and returned through the regular InputStream interface.
The stream must be closed after use so that the wrapped input stream and the encoder resources are released. When the end of the wrapped input stream is reached, the encoder is finalized automatically so that any required padding characters are emitted.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseEncoderInputStream(File aInputFile, BaseMetrics aBaseMetrics) Constructs aBaseEncoderInputStreamusing the given file and the provided base metrics.BaseEncoderInputStream(InputStream aInputStream, BaseMetrics aBaseMetrics) Constructs aBaseEncoderInputStreamusing the given input stream and the provided base metrics. -
Method Summary
Methods inherited from class InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
BaseEncoderInputStream
public BaseEncoderInputStream(InputStream aInputStream, BaseMetrics aBaseMetrics) throws IOException Constructs aBaseEncoderInputStreamusing the given input stream and the provided base metrics.- Parameters:
aInputStream- The input stream providing the decoded data.aBaseMetrics- The base metrics used to encode the data.- Throws:
IOException- Thrown in case initializing the encoder caused an I/O-related problem.
-
BaseEncoderInputStream
Constructs aBaseEncoderInputStreamusing the given file and the provided base metrics.- Parameters:
aInputFile- The file providing the decoded data.aBaseMetrics- The base metrics used to encode the data.- Throws:
IOException- Thrown in case opening the file or initializing the encoder caused an I/O-related problem.
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
isClosed
public boolean isClosed()Determines whether this stream has been closed.- Returns:
trueif this stream has been closed.
-