public class LZFOutputStream extends FilterOutputStream implements WritableByteChannel
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.
|
protected byte[] |
_outputBuffer |
protected boolean |
_outputStreamClosed
Flag that indicates if we have already called '_outputStream.close()'
(to avoid calling it multiple times)
|
protected int |
_position |
out
Constructor and Description |
---|
LZFOutputStream(ChunkEncoder encoder,
OutputStream outputStream) |
LZFOutputStream(ChunkEncoder encoder,
OutputStream outputStream,
BufferRecycler bufferRecycler) |
LZFOutputStream(ChunkEncoder encoder,
OutputStream outputStream,
int bufferSize,
BufferRecycler bufferRecycler) |
LZFOutputStream(OutputStream outputStream) |
LZFOutputStream(OutputStream outputStream,
BufferRecycler bufferRecycler) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkNotClosed() |
void |
close() |
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.
|
void |
flush() |
boolean |
getFinishBlockOnFlush()
Accessor for checking whether call to "flush()" will first finish the
current block or not.
|
OutputStream |
getUnderlyingOutputStream()
Method that can be used to find underlying
OutputStream that
we write encoded LZF encoded data into, after compressing it. |
boolean |
isOpen() |
LZFOutputStream |
setFinishBlockOnFlush(boolean b)
Method for defining whether call to
flush() will also complete
current block (similar to calling finishBlock() ) or not. |
void |
write(byte[] buffer,
int offset,
int length) |
int |
write(ByteBuffer src) |
void |
write(FileChannel in) |
void |
write(InputStream in) |
void |
write(int singleByte) |
protected void |
writeCompressedBlock()
Compress and write the current block to the OutputStream
|
write
protected byte[] _outputBuffer
protected int _position
protected boolean _cfgFinishBlockOnFlush
Default value is 'true'
protected boolean _outputStreamClosed
public LZFOutputStream(OutputStream outputStream)
public LZFOutputStream(ChunkEncoder encoder, OutputStream outputStream)
public LZFOutputStream(OutputStream outputStream, BufferRecycler bufferRecycler)
public LZFOutputStream(ChunkEncoder encoder, OutputStream outputStream, BufferRecycler bufferRecycler)
public LZFOutputStream(ChunkEncoder encoder, OutputStream outputStream, int bufferSize, BufferRecycler bufferRecycler)
public LZFOutputStream setFinishBlockOnFlush(boolean b)
flush()
will also complete
current block (similar to calling finishBlock()
) or not.public void write(int singleByte) throws IOException
write
in class FilterOutputStream
IOException
public void write(byte[] buffer, int offset, int length) throws IOException
write
in class FilterOutputStream
IOException
public void write(InputStream in) throws IOException
IOException
public void write(FileChannel in) throws IOException
IOException
public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class FilterOutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in class FilterOutputStream
IOException
public OutputStream getUnderlyingOutputStream()
OutputStream
that
we write encoded LZF encoded data into, after compressing it.
Will never return null; although underlying stream may be closed
(if this stream has been closed).public boolean getFinishBlockOnFlush()
public LZFOutputStream finishBlock() throws IOException
IOException
protected void writeCompressedBlock() throws IOException
IOException
protected void checkNotClosed() throws IOException
IOException
Copyright © 2024. All rights reserved.