public class LZFFileOutputStream extends FileOutputStream implements WritableByteChannel
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 | 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 |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkNotClosed() |
void |
close() |
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.
|
void |
flush() |
boolean |
getFinishBlockOnFlush()
Accessor for checking whether call to "flush()" will first finish the
current block or not
|
boolean |
isOpen() |
protected void |
rawWrite(byte[] buffer,
int offset,
int length) |
LZFFileOutputStream |
setFinishBlockOnFlush(boolean b)
Method for defining whether call to
flush() will also complete
current block (similar to calling finishBlock()) or not. |
void |
write(byte[] b) |
void |
write(byte[] buffer,
int offset,
int length) |
int |
write(ByteBuffer src) |
void |
write(FileChannel in) |
void |
write(InputStream in) |
void |
write(int b) |
protected void |
writeCompressedBlock()
Compress and write the current block to the OutputStream
|
finalize, getChannel, getFDprotected byte[] _outputBuffer
protected int _position
protected boolean _cfgFinishBlockOnFlush
Default value is 'true'.
protected boolean _outputStreamClosed
public LZFFileOutputStream(File file) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(File file, boolean append) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(FileDescriptor fdObj)
public LZFFileOutputStream(String name) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(String name, boolean append) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, File file) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj)
public LZFFileOutputStream(ChunkEncoder encoder, String name) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, File file, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj, BufferRecycler bufferRecycler)
public LZFFileOutputStream(ChunkEncoder encoder, String name, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundExceptionpublic LZFFileOutputStream setFinishBlockOnFlush(boolean b)
flush() will also complete
current block (similar to calling finishBlock()) or not.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class FileOutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class FileOutputStreamIOExceptionpublic void write(byte[] buffer,
int offset,
int length)
throws IOException
write in class FileOutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class FileOutputStreamIOExceptionpublic void write(InputStream in) throws IOException
IOExceptionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic void write(FileChannel in) throws IOException
IOExceptionpublic boolean getFinishBlockOnFlush()
public LZFFileOutputStream finishBlock() throws IOException
IOExceptionprotected void writeCompressedBlock()
throws IOException
IOExceptionprotected void rawWrite(byte[] buffer,
int offset,
int length)
throws IOException
IOExceptionprotected void checkNotClosed()
throws IOException
IOExceptionCopyright © 2023 FasterXML. All rights reserved.