net.jpountz.lz4
Class LZ4BlockOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- net.jpountz.lz4.LZ4BlockOutputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
public final class LZ4BlockOutputStream extends java.io.FilterOutputStreamStreaming LZ4.This class compresses data into fixed-size blocks of compressed data.
- See Also:
LZ4BlockInputStream
-
-
Constructor Summary
Constructors Constructor and Description LZ4BlockOutputStream(java.io.OutputStream out)Create a new instance which compresses into blocks of 64 KB.LZ4BlockOutputStream(java.io.OutputStream out, int blockSize)Create a new instance which compresses with the standard LZ4 compression algorithm.LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor)Create a new instance which checks stream integrity usingStreamingXXHash32and doesn't sync flush.LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor, java.util.zip.Checksum checksum, boolean syncFlush)Create a newOutputStreamwith configurable block size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()voidfinish()Same asclose()except that it doesn't close the underlying stream.voidflush()Flush this compressedOutputStream.java.lang.StringtoString()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
LZ4BlockOutputStream
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor, java.util.zip.Checksum checksum, boolean syncFlush)Create a newOutputStreamwith configurable block size. Large blocks require more memory at compression and decompression time but should improve the compression ratio.- Parameters:
out- theOutputStreamto feedblockSize- the maximum number of bytes to try to compress at once, must be >= 64 and <= 32 Mcompressor- theLZ4Compressorinstance to use to compress datachecksum- theChecksuminstance to use to check data for integrity.syncFlush- true if pending data should also be flushed onflush()
-
LZ4BlockOutputStream
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize, LZ4Compressor compressor)Create a new instance which checks stream integrity usingStreamingXXHash32and doesn't sync flush.
-
LZ4BlockOutputStream
public LZ4BlockOutputStream(java.io.OutputStream out, int blockSize)Create a new instance which compresses with the standard LZ4 compression algorithm.
-
LZ4BlockOutputStream
public LZ4BlockOutputStream(java.io.OutputStream out)
Create a new instance which compresses into blocks of 64 KB.- See Also:
LZ4BlockOutputStream(OutputStream, int)
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlush this compressedOutputStream. If the stream has been created withsyncFlush=true, pending data will be compressed and appended to the underlyingOutputStreambefore callingOutputStream.flush()on the underlying stream. Otherwise, this method just flushes the underlying stream, so pending data might not be available for reading untilfinish()orclose()is called.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionSame asclose()except that it doesn't close the underlying stream. This can be useful if you want to keep on using the underlying stream.- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG