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
|
writeprotected 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 FilterOutputStreamIOExceptionpublic void write(byte[] buffer,
int offset,
int length)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void write(InputStream in) throws IOException
IOExceptionpublic void write(FileChannel in) throws IOException
IOExceptionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic void flush()
throws IOException
flush method does nothing.flush in interface Flushableflush in class FilterOutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class FilterOutputStreamIOExceptionpublic 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
IOExceptionprotected void checkWriteException()
throws IOException
IOExceptionprotected void checkNotClosed()
throws IOException
IOExceptionCopyright © 2014. All Rights Reserved.