public class LZ4BlockOutputStream
extends java.io.FilterOutputStream
LZ4FrameOutputStream
,
which is compatible with the LZ4 Frame format. This class remains for backward compatibility.LZ4BlockInputStream
,
LZ4FrameOutputStream
Constructor and Description |
---|
LZ4BlockOutputStream(java.io.OutputStream out)
Creates a new instance which compresses into blocks of 64 KB.
|
LZ4BlockOutputStream(java.io.OutputStream out,
int blockSize)
Creates a new instance which compresses with the standard LZ4 compression
algorithm.
|
LZ4BlockOutputStream(java.io.OutputStream out,
int blockSize,
LZ4Compressor compressor)
Creates a new instance which checks stream integrity using
StreamingXXHash32 and doesn't sync flush. |
LZ4BlockOutputStream(java.io.OutputStream out,
int blockSize,
LZ4Compressor compressor,
java.util.zip.Checksum checksum,
boolean syncFlush)
Creates a new
OutputStream with configurable block size. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
finish()
Same as
close() except that it doesn't close the underlying stream. |
void |
flush()
Flushes this compressed
OutputStream . |
java.lang.String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor, java.util.zip.Checksum checksum, boolean syncFlush)
OutputStream
with configurable block size. Large
blocks require more memory at compression and decompression time but
should improve the compression ratio.out
- the OutputStream
to feedblockSize
- the maximum number of bytes to try to compress at once,
must be >= 64 and <= 32 Mcompressor
- the LZ4Compressor
instance to use to compress
datachecksum
- the Checksum
instance to use to check data for
integrity.syncFlush
- true if pending data should also be flushed on flush()
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor)
StreamingXXHash32
and doesn't sync flush.out
- the OutputStream
to feedblockSize
- the maximum number of bytes to try to compress at once,
must be >= 64 and <= 32 Mcompressor
- the LZ4Compressor
instance to use to compress
dataLZ4BlockOutputStream(OutputStream, int, LZ4Compressor, Checksum, boolean)
,
StreamingXXHash32.asChecksum()
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize)
out
- the OutputStream
to feedblockSize
- the maximum number of bytes to try to compress at once,
must be >= 64 and <= 32 MLZ4BlockOutputStream(OutputStream, int, LZ4Compressor)
,
LZ4Factory.fastCompressor()
public LZ4BlockOutputStream(java.io.OutputStream out)
out
- the OutputStream
to feedLZ4BlockOutputStream(OutputStream, int)
public void write(int b) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterOutputStream
java.io.IOException
public void flush() throws java.io.IOException
OutputStream
.
If the stream has been created with syncFlush=true
, pending
data will be compressed and appended to the underlying OutputStream
before calling OutputStream.flush()
on the underlying stream.
Otherwise, this method just flushes the underlying stream, so pending
data might not be available for reading until finish()
or
close()
is called.flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
public void finish() throws java.io.IOException
close()
except that it doesn't close the underlying stream.
This can be useful if you want to keep on using the underlying stream.java.io.IOException
- if an I/O error occurs.public java.lang.String toString()
toString
in class java.lang.Object