FileOutputStream.
Note that use of this class is not recommended unless you absolutely must
use a FileOutputStream instance; otherwise basic LZFOutputStream
(which uses aggregation for underlying streams) is more appropriate
Implementation Note
much of the code is just copied from LZFOutputStream,
so care must be taken to keep implementations in sync if there are fixes.
| Modifier and Type | Class and Description |
|---|---|
| private class | LZFFileOutputStream.Wrapper
This simple wrapper is needed to re-route read calls so that they will use "raw" writes |
| 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 final LZFFileOutputStream. | _wrapper
Wrapper object we use to allow decoder to write directly to the stream, without ending in infinite loop... |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | |
| public | LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append, BufferRecycler bufferRecycler)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | close()
Overrides java. Implements java. |
| public LZFFileOutputStream | 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 boolean | |
| protected void | |
| public LZFFileOutputStream | setFinishBlockOnFlush(boolean b)
Method for defining whether call to |
| public void | write(byte[]
the data. b)Overrides java. b.length bytes from the specified byte array
to this file output stream.
|
| public void | write(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 file output stream.
|
| public void | write(int
the byte to be written. b)Overrides java. |
| public void | |
| public synchronized int | write(final ByteBuffer
The buffer from which bytes are to be retrieved src)Implements java. |
| public void | |
| 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 | |
| _wrapper | back to summary |
|---|---|
| private final LZFFileOutputStream. Wrapper object we use to allow decoder to write directly to the stream, without ending in infinite loop... | |
| OUTPUT_BUFFER_SIZE | back to summary |
|---|---|
| private static final int OUTPUT_BUFFER_SIZE | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(File file) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(File file, boolean append) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(FileDescriptor fdObj) | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(String name) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(String name, boolean append) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, File file) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj) | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, String name) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, File file, BufferRecycler bufferRecycler) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj, BufferRecycler bufferRecycler) | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, String name, BufferRecycler bufferRecycler) throws FileNotFoundException | |
| LZFFileOutputStream | back to summary |
|---|---|
| public LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException | |
| 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 LZFFileOutputStream 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. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| getFinishBlockOnFlush | back to summary |
|---|---|
| public boolean getFinishBlockOnFlush() Accessor for checking whether call to "flush()" will first finish the current block or not | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| rawWrite | back to summary |
|---|---|
| protected void rawWrite(byte[] buffer, int offset, int length) throws IOException | |
| setFinishBlockOnFlush | back to summary |
|---|---|
| public LZFFileOutputStream setFinishBlockOnFlush(boolean b) Method for defining whether call to | |
| write | back to summary |
|---|---|
| public void write(byte[] b) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(byte[] buffer, int offset, int length) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Overrides java. Doc from java. Writes the specified byte to this file output stream. Implements
the
| |
| write | back to summary |
|---|---|
| public void write(final InputStream 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.
| |
| write | back to summary |
|---|---|
| public void write(final FileChannel in) throws IOException | |
| writeCompressedBlock | back to summary |
|---|---|
| protected void writeCompressedBlock() throws IOException Compress and write the current block to the OutputStream | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | write(int
the arg0)byte.Implements abstract java. |
| public void | write(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.
|
| Wrapper | back to summary |
|---|---|
| private Wrapper() | |
| write | back to summary |
|---|---|
| public void write(int arg0) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] buffer, int offset, int length) throws IOException Overrides java. Doc from java. Writes
If
If
| |