public class PLZFOutputStream 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.
This class uses a parallel implementation to make use of all available cores, modulo system load.
LZFInputStream
,
LZFCompressingInputStream
,
LZFOutputStream
Modifier and Type | Field and Description |
---|---|
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
Modifier | Constructor and Description |
---|---|
|
PLZFOutputStream(OutputStream outputStream) |
protected |
PLZFOutputStream(OutputStream outputStream,
int nThreads) |
protected |
PLZFOutputStream(OutputStream outputStream,
int bufferSize,
int nThreads) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkNotClosed() |
protected void |
checkWriteException() |
void |
close() |
void |
flush()
This
flush method does nothing. |
protected static int |
getNThreads() |
OutputStream |
getUnderlyingOutputStream()
Method that can be used to find underlying
OutputStream that
we write encoded LZF encoded data into, after compressing it. |
boolean |
isOpen() |
void |
write(byte[] buffer,
int offset,
int length) |
int |
write(ByteBuffer src) |
void |
write(FileChannel in) |
void |
write(InputStream in) |
void |
write(int singleByte)
WARNING: using this method will lead to very poor performance!
|
protected void |
writeCompressedBlock()
Compress and write the current block to the OutputStream
|
write
protected byte[] _outputBuffer
protected int _position
protected boolean _outputStreamClosed
public PLZFOutputStream(OutputStream outputStream)
protected PLZFOutputStream(OutputStream outputStream, int nThreads)
protected PLZFOutputStream(OutputStream outputStream, int bufferSize, int nThreads)
protected static int getNThreads()
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
method does nothing.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).protected void writeCompressedBlock() throws IOException
IOException
protected void checkWriteException() throws IOException
IOException
protected void checkNotClosed() throws IOException
IOException
Copyright © 2023. All rights reserved.