Class ZstdOutputStreamNoFinalizer
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.github.luben.zstd.ZstdOutputStreamNoFinalizer
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
OutputStream filter that compresses the data using Zstd compression.
-
Field Summary
Fields inherited from class FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionZstdOutputStreamNoFinalizer(@NotNull OutputStream outStream) create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull OutputStream outStream, int level) create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull OutputStream outStream, @NotNull BufferPool bufferPool) create a new compressing OutputStreamZstdOutputStreamNoFinalizer(@NotNull OutputStream outStream, @NotNull BufferPool bufferPool, int level) create a new compressing OutputStream -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidvoidflush()Flushes the outputstatic long@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) Methods inherited from class FilterOutputStream
writeMethods inherited from class OutputStream
nullOutputStream
-
Constructor Details
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull OutputStream outStream, int level) throws IOException create a new compressing OutputStream- Parameters:
outStream- the stream to wraplevel- the compression level- Throws:
IOException
-
ZstdOutputStreamNoFinalizer
create a new compressing OutputStream- Parameters:
outStream- the stream to wrap- Throws:
IOException
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull OutputStream outStream, @NotNull @NotNull BufferPool bufferPool, int level) throws IOException create a new compressing OutputStream- Parameters:
outStream- the stream to wrapbufferPool- the pool to fetch and return buffers- Throws:
IOException
-
ZstdOutputStreamNoFinalizer
public ZstdOutputStreamNoFinalizer(@NotNull @NotNull OutputStream outStream, @NotNull @NotNull BufferPool bufferPool) throws IOException create a new compressing OutputStream- Parameters:
outStream- the stream to wrapbufferPool- the pool to fetch and return buffers- Throws:
IOException
-
-
Method Details
-
recommendedCOutSize
public static long recommendedCOutSize() -
setChecksum
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setChecksum(boolean useChecksums) throws IOException Enable checksums for the compressed stream. Default: false- Throws:
IOException
-
setLevel
Set the compression level. Default:Zstd.defaultCompressionLevel()- Throws:
IOException
-
setLong
Enable Long Distance Matching and set the Window size Log. Values for windowLog outside the range 10-27 will disable and reset LDM- Throws:
IOException
-
setWorkers
Enable use of worker threads for parallel compression. Default: no worker threads.- Throws:
IOException
-
setOverlapLog
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setOverlapLog(int overlapLog) throws 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:
IOException
-
setJobSize
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:
IOException
-
setTargetLength
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setTargetLength(int targetLength) throws IOException Advanced Compression Option: Set the target match length. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
IOException
-
setMinMatch
Advanced Compression Option: Set the minimum match length. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.- Throws:
IOException
-
setSearchLog
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:
IOException
-
setChainLog
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:
IOException
-
setHashLog
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:
IOException
-
setWindowLog
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:
IOException
-
setStrategy
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:
IOException
-
setCloseFrameOnFlush
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 IOException - Throws:
IOException
-
setDict
@NotNull public @NotNull ZstdOutputStreamNoFinalizer setDict(@NotNull @NotNull ZstdDictCompress dict) throws IOException - Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
flush
Flushes the output- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
closeWithoutClosingParentStream
- Throws:
IOException
-