|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FileOutputStream
com.ning.compress.lzf.util.LZFFileOutputStream
public class LZFFileOutputStream
Helper class that allows use of LZF compression even if a library requires
use of 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.
Field Summary | |
---|---|
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
|
Constructor Summary | |
---|---|
LZFFileOutputStream(File file)
|
|
LZFFileOutputStream(File file,
boolean append)
|
|
LZFFileOutputStream(FileDescriptor fdObj)
|
|
LZFFileOutputStream(String name)
|
|
LZFFileOutputStream(String name,
boolean append)
|
Method Summary | |
---|---|
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 |
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)
|
void |
write(int b)
|
protected void |
writeCompressedBlock()
Compress and write the current block to the OutputStream |
Methods inherited from class java.io.FileOutputStream |
---|
finalize, getChannel, getFD |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte[] _outputBuffer
protected int _position
protected boolean _cfgFinishBlockOnFlush
Default value is 'true'
protected boolean _outputStreamClosed
Constructor Detail |
---|
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
Method Detail |
---|
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 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 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |