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, getFD
protected byte[] _outputBuffer
protected int _position
protected boolean _cfgFinishBlockOnFlush
Default value is 'true'.
protected boolean _outputStreamClosed
public LZFFileOutputStream(File file) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(File file, boolean append) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(FileDescriptor fdObj)
public LZFFileOutputStream(String name) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(String name, boolean append) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, File file) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj)
public LZFFileOutputStream(ChunkEncoder encoder, String name) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, File file, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, File file, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, FileDescriptor fdObj, BufferRecycler bufferRecycler)
public LZFFileOutputStream(ChunkEncoder encoder, String name, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream(ChunkEncoder encoder, String name, boolean append, BufferRecycler bufferRecycler) throws FileNotFoundException
FileNotFoundException
public LZFFileOutputStream setFinishBlockOnFlush(boolean b)
flush()
will also complete
current block (similar to calling finishBlock()
) or not.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in class FileOutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class FileOutputStream
IOException
public void write(byte[] buffer, int offset, int length) throws IOException
write
in class FileOutputStream
IOException
public void write(int b) throws IOException
write
in class FileOutputStream
IOException
public void write(InputStream in) throws IOException
IOException
public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
public void write(FileChannel in) throws IOException
IOException
public boolean getFinishBlockOnFlush()
public LZFFileOutputStream finishBlock() throws IOException
IOException
protected void writeCompressedBlock() throws IOException
IOException
protected void rawWrite(byte[] buffer, int offset, int length) throws IOException
IOException
protected void checkNotClosed() throws IOException
IOException
Copyright © 2023 FasterXML. All rights reserved.