OutputStream implementation that will compress
output using LZF compression algorithm, given uncompressed input
to write. Its counterpart is LZFInputStream; although
in some ways LZFCompressingInputStream can be seen
as the opposite.
LZFInputStream, LZFCompressingInputStream
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | _cfgFinishBlockOnFlush
Configuration setting that governs whether basic 'flush()' should first complete a block or not. |
| private final ChunkEncoder | |
| protected byte[] | |
| protected boolean | _outputStreamClosed
Flag that indicates if we have already called '_outputStream.close()' (to avoid calling it multiple times) |
| protected int | |
| private final BufferRecycler | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | LZFOutputStream(final ChunkEncoder encoder, final OutputStream outputStream, final BufferRecycler bufferRecycler)
|
| public | LZFOutputStream(final ChunkEncoder encoder, final OutputStream outputStream, final int bufferSize, BufferRecycler bufferRecycler)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | close()
Overrides java. Implements java. |
| public LZFOutputStream | finishBlock()
Method that can be used to force completion of the current block, which means that all buffered data will be compressed into an LZF block. |
| public void | flush()
Overrides java. Implements java. |
| public boolean | getFinishBlockOnFlush()
Accessor for checking whether call to "flush()" will first finish the current block or not. |
| public OutputStream | getUnderlyingOutputStream()
Method that can be used to find underlying |
| public boolean | |
| public LZFOutputStream | setFinishBlockOnFlush(boolean b)
Method for defining whether call to |
| public void | write(final int
the singleByte)byte.Overrides java. byte to this output stream.
|
| public void | write(final byte[]
the data. buffer, int the start offset in the data. offset, int the number of bytes to write. length)Overrides java. len bytes from the specified
byte array starting at offset off to
this output stream.
|
| public void | |
| public void | |
| public synchronized int | write(final ByteBuffer
The buffer from which bytes are to be retrieved src)Implements java. |
| protected void |
| _cfgFinishBlockOnFlush | back to summary |
|---|---|
| protected boolean _cfgFinishBlockOnFlush Configuration setting that governs whether basic 'flush()' should first complete a block or not. Default value is 'true' | |
| _encoder | back to summary |
|---|---|
| private final ChunkEncoder _encoder | |
| _outputBuffer | back to summary |
|---|---|
| protected byte[] _outputBuffer | |
| _outputStreamClosed | back to summary |
|---|---|
| protected boolean _outputStreamClosed Flag that indicates if we have already called '_outputStream.close()' (to avoid calling it multiple times) | |
| _position | back to summary |
|---|---|
| protected int _position | |
| _recycler | back to summary |
|---|---|
| private final BufferRecycler _recycler | |
| DEFAULT_OUTPUT_BUFFER_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_OUTPUT_BUFFER_SIZE | |
| LZFOutputStream | back to summary |
|---|---|
| public LZFOutputStream(final OutputStream outputStream) | |
| LZFOutputStream | back to summary |
|---|---|
| public LZFOutputStream(final ChunkEncoder encoder, final OutputStream outputStream) | |
| LZFOutputStream | back to summary |
|---|---|
| public LZFOutputStream(final OutputStream outputStream, final BufferRecycler bufferRecycler) | |
| LZFOutputStream | back to summary |
|---|---|
| public LZFOutputStream(final ChunkEncoder encoder, final OutputStream outputStream, final BufferRecycler bufferRecycler) | |
| LZFOutputStream | back to summary |
|---|---|
| public LZFOutputStream(final ChunkEncoder encoder, final OutputStream outputStream, final int bufferSize, BufferRecycler bufferRecycler) | |
| checkNotClosed | back to summary |
|---|---|
| protected void checkNotClosed() throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this channel. After a channel is closed, any further attempt to invoke I/O
operations upon it will cause a If this channel is already closed then invoking this method has no effect. This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
| |
| finishBlock | back to summary |
|---|---|
| public LZFOutputStream finishBlock() throws IOException Method that can be used to force completion of the current block, which means that all buffered data will be compressed into an LZF block. This typically results in lower compression ratio as larger blocks compress better; but may be necessary for network connections to ensure timely sending of data. | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes to be written out to the stream.
| |
| getFinishBlockOnFlush | back to summary |
|---|---|
| public boolean getFinishBlockOnFlush() Accessor for checking whether call to "flush()" will first finish the current block or not. | |
| getUnderlyingOutputStream | back to summary |
|---|---|
| public OutputStream getUnderlyingOutputStream() Method that can be used to find underlying | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| setFinishBlockOnFlush | back to summary |
|---|---|
| public LZFOutputStream setFinishBlockOnFlush(boolean b) Method for defining whether call to | |
| write | back to summary |
|---|---|
| public void write(final int singleByte) throws IOException Overrides java. Doc from java. Writes the specified
The
Implements the abstract
| |
| write | back to summary |
|---|---|
| public void write(final byte[] buffer, int offset, int length) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(final InputStream in) throws IOException | |
| write | back to summary |
|---|---|
| public void write(final FileChannel in) throws IOException | |
| write | back to summary |
|---|---|
| public synchronized int write(final ByteBuffer src) throws IOException Implements java. Doc from java. Writes a sequence of bytes to this channel from the given buffer. An attempt is made to write up to r bytes to the channel,
where r is the number of bytes remaining in the buffer, that is,
Suppose that a byte sequence of length n is written, where
Unless otherwise specified, a write operation will return only after writing all of the r requested bytes. Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer. This method may be invoked at any time. If another thread has already initiated a write operation upon this channel, however, then an invocation of this method will block until the first operation is complete.
| |
| writeCompressedBlock | back to summary |
|---|---|
| protected void writeCompressedBlock() throws IOException Compress and write the current block to the OutputStream | |