Package com.github.luben.zstd
Class ZstdOutputStreamNoFinalizer
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.github.luben.zstd.ZstdOutputStreamNoFinalizer
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class ZstdOutputStreamNoFinalizer extends java.io.FilterOutputStreamOutputStream filter that compresses the data using Zstd compression.
-
-
Constructor Summary
Constructors Constructor Description ZstdOutputStreamNoFinalizer(@NotNull java.io.OutputStream outStream)create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull java.io.OutputStream outStream, int level)create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull java.io.OutputStream outStream, @NotNull BufferPool bufferPool)create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull java.io.OutputStream outStream, @NotNull BufferPool bufferPool, int level)create a new compressing OutputStream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseWithoutClosingParentStream()voidflush()Flushes the outputstatic longrecommendedCOutSize()@NotNull ZstdOutputStreamNoFinalizersetChainLog(int chainLog)Advanced Compression Option: Set the maximum number of bits for the secondary search structure.@NotNull ZstdOutputStreamNoFinalizersetChecksum(boolean useChecksums)Enable checksums for the compressed stream.@NotNull ZstdOutputStreamNoFinalizersetCloseFrameOnFlush(boolean closeOnFlush)Enable closing the frame on flush.@NotNull ZstdOutputStreamNoFinalizersetDict(byte @NotNull [] dict)@NotNull ZstdOutputStreamNoFinalizersetDict(@NotNull ZstdDictCompress dict)@NotNull ZstdOutputStreamNoFinalizersetHashLog(int hashLog)Advanced Compression Option: Set the maximum number of bits for a hash table.@NotNull ZstdOutputStreamNoFinalizersetJobSize(int jobSize)Advanced Compression Option: Set the size of each compression job.@NotNull ZstdOutputStreamNoFinalizersetLevel(int level)Set the compression level.@NotNull ZstdOutputStreamNoFinalizersetLong(int windowLog)Enable Long Distance Matching and set the Window size Log.@NotNull ZstdOutputStreamNoFinalizersetMinMatch(int minMatch)Advanced Compression Option: Set the minimum match length.@NotNull ZstdOutputStreamNoFinalizersetOverlapLog(int overlapLog)Advanced Compression Option: Set the amount of data reloaded from the previous job.@NotNull ZstdOutputStreamNoFinalizersetSearchLog(int searchLog)Advanced Compression Option: Set the maximum number of searches in a hash chain or a binary tree using logarithmic scale.@NotNull ZstdOutputStreamNoFinalizersetStrategy(int strategy)Advanced Compression Option: Set the strategy used by a match finder.@NotNull ZstdOutputStreamNoFinalizersetTargetLength(int targetLength)Advanced Compression Option: Set the target match length.@NotNull ZstdOutputStreamNoFinalizersetWindowLog(int windowLog)Advanced Compression Option: Set the maximum number of bits for a match distance.@NotNull ZstdOutputStreamNoFinalizersetWorkers(int n)Enable use of worker threads for parallel compression.voidwrite(byte @NotNull [] src, int offset, int len)voidwrite(int i)
-
-
-
Constructor Detail
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull java.io.OutputStream outStream, int level) throws java.io.IOExceptioncreate a new compressing OutputStream- Parameters:
outStream- the stream to wraplevel- the compression level- Throws:
java.io.IOException
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull java.io.OutputStream outStream) throws java.io.IOExceptioncreate a new compressing OutputStream- Parameters:
outStream- the stream to wrap- Throws:
java.io.IOException
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull java.io.OutputStream outStream, @NotNull @NotNull BufferPool bufferPool, int level) throws java.io.IOExceptioncreate a new compressing OutputStream- Parameters:
outStream- the stream to wrapbufferPool- the pool to fetch and return buffers- Throws:
java.io.IOException
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull java.io.OutputStream outStream, @NotNull @NotNull BufferPool bufferPool) throws java.io.IOExceptioncreate a new compressing OutputStream- Parameters:
outStream- the stream to wrapbufferPool- the pool to fetch and return buffers- Throws:
java.io.IOException
-
-
Method Detail
-
recommendedCOutSize
public static long recommendedCOutSize()
-
setChecksum
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setChecksum(boolean useChecksums) throws java.io.IOException
Enable checksums for the compressed stream. Default: false- Throws:
java.io.IOException
-
setLevel
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setLevel(int level) throws java.io.IOException
Set the compression level. Default:Zstd.defaultCompressionLevel()- Throws:
java.io.IOException
-
setLong
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setLong(int windowLog) throws java.io.IOException
Enable Long Distance Matching and set the Window size Log. Values for windowLog outside the range 10-27 will disable and reset LDM- Throws:
java.io.IOException
-
setWorkers
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setWorkers(int n) throws java.io.IOException
Enable use of worker threads for parallel compression. Default: no worker threads.- Throws:
java.io.IOException
-
setOverlapLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setOverlapLog(int overlapLog) throws java.io.IOException
Advanced Compression Option: Set the amount of data reloaded from the previous job. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setJobSize
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setJobSize(int jobSize) throws java.io.IOException
Advanced Compression Option: Set the size of each compression job. Only applies when multi threaded compression is enabled. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setTargetLength
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setTargetLength(int targetLength) throws java.io.IOException
Advanced Compression Option: Set the target match length. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setMinMatch
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setMinMatch(int minMatch) throws java.io.IOException
Advanced Compression Option: Set the minimum match length. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setSearchLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setSearchLog(int searchLog) throws java.io.IOException
Advanced Compression Option: Set the maximum number of searches in a hash chain or a binary tree using logarithmic scale. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setChainLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setChainLog(int chainLog) throws java.io.IOException
Advanced Compression Option: Set the maximum number of bits for the secondary search structure. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setHashLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setHashLog(int hashLog) throws java.io.IOException
Advanced Compression Option: Set the maximum number of bits for a hash table. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setWindowLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setWindowLog(int windowLog) throws java.io.IOException
Advanced Compression Option: Set the maximum number of bits for a match distance. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setStrategy
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setStrategy(int strategy) throws java.io.IOException
Advanced Compression Option: Set the strategy used by a match finder. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
java.io.IOException
-
setCloseFrameOnFlush
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setCloseFrameOnFlush(boolean closeOnFlush)
Enable closing the frame on flush. This will guarantee that it can be ready fully if the process crashes before closing the stream. On the downside it will negatively affect the compression ratio. Default: false.
-
setDict
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setDict(byte @NotNull [] dict) throws java.io.IOException
- Throws:
java.io.IOException
-
setDict
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setDict(@NotNull @NotNull ZstdDictCompress dict) throws java.io.IOException
- Throws:
java.io.IOException
-
write
public void write(byte @NotNull [] src, int offset, int len) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(int i) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlushes the output- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
closeWithoutClosingParentStream
public void closeWithoutClosingParentStream() throws java.io.IOException- Throws:
java.io.IOException
-
-