OutputStream implementation that will compress
output using LZF compression algorithm, given uncompressed input
to write. Its counterpart is com.ning.compress.lzf.LZFInputStream ; although
in some ways com.ning.compress.lzf.LZFCompressingInputStream can be seen
as the opposite.
This class uses a parallel implementation to make use of all available cores, modulo system load.
com.ning.compress.lzf.LZFInputStream , com.ning.compress.lzf.LZFCompressingInputStream , com.ning.compress.lzf.LZFOutputStream
| Modifier and Type | Field and Description |
|---|---|
| protected byte[] | |
| protected boolean | _outputStreamClosed
Flag that indicates if we have already called '_outputStream.close()' (to avoid calling it multiple times) |
| protected int | |
| private BlockManager | |
| private final ExecutorService | |
| private static final int | |
| pack-priv volatile Exception | |
| private final ExecutorService |
| Access | Constructor and Description |
|---|---|
| public | |
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| public void | close()
Overrides java. Implements java. |
| public void | flush()
Overrides java. Implements java. flush method does nothing.
|
| protected static int | |
| public OutputStream | getUnderlyingOutputStream()
Method that can be used to find underlying |
| public boolean | |
| 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 |
| _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 | |
| blockManager | back to summary |
|---|---|
| private BlockManager blockManager | |
| compressExecutor | back to summary |
|---|---|
| private final ExecutorService compressExecutor | |
| DEFAULT_OUTPUT_BUFFER_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_OUTPUT_BUFFER_SIZE | |
| writeException | back to summary |
|---|---|
| pack-priv volatile Exception writeException | |
| writeExecutor | back to summary |
|---|---|
| private final ExecutorService writeExecutor | |
| PLZFOutputStream | back to summary |
|---|---|
| public PLZFOutputStream(final OutputStream outputStream) | |
| PLZFOutputStream | back to summary |
|---|---|
| protected PLZFOutputStream(final OutputStream outputStream, int nThreads) | |
| PLZFOutputStream | back to summary |
|---|---|
| protected PLZFOutputStream(final OutputStream outputStream, final int bufferSize, int nThreads) | |
| checkNotClosed | back to summary |
|---|---|
| protected void checkNotClosed() throws IOException | |
| checkWriteException | back to summary |
|---|---|
| protected void checkWriteException() 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.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. This
| |
| getNThreads | back to summary |
|---|---|
| protected static int getNThreads() | |
| 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.
| |
| write | back to summary |
|---|---|
| public void write(final int singleByte) throws IOException Overrides java. Doc from java. Writes the specified
The
Implements the abstract Warning using this method will lead to very poor performance!
| |
| 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 | |