Top Description Fields Constructors Methods
com.github.luben.zstd

public Class ZstdOutputStreamNoFinalizer

extends FilterOutputStream
Class Inheritance
Imports
java.io.OutputStream, .FilterOutputStream, .IOException, java.nio.ByteBuffer, com.github.luben.zstd.util.Native

OutputStream filter that compresses the data using Zstd compression.

Field Summary

Modifier and TypeField and Description
private final BufferPool
private boolean
private final byte[]
private final ByteBuffer
private long
private static final int
private boolean
private boolean
private boolean
private long
private final long
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
ZstdOutputStreamNoFinalizer(OutputStream
the stream to wrap
outStream
,
int
the compression level
level
)

create a new compressing OutputStream

public
ZstdOutputStreamNoFinalizer(OutputStream
the stream to wrap
outStream
)

create a new compressing OutputStream

public
ZstdOutputStreamNoFinalizer(OutputStream
the stream to wrap
outStream
,
BufferPool
the pool to fetch and return buffers
bufferPool
,
int level)

create a new compressing OutputStream

public
ZstdOutputStreamNoFinalizer(OutputStream
the stream to wrap
outStream
,
BufferPool
the pool to fetch and return buffers
bufferPool
)

create a new compressing OutputStream

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with the stream.
private void
close(boolean closeParentStream)

public synchronized void
private native int
compressStream(long ctx, byte[] dst, int dst_size, byte[] src, int src_size)

private static native long
private native int
endStream(long ctx, byte[] dst, int dst_size)

public synchronized void
flush()

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes the output
private native int
flushStream(long ctx, byte[] dst, int dst_size)

private static native int
freeCStream(long ctx)

public static native long
private native int
resetCStream(long ctx)

public synchronized ZstdOutputStreamNoFinalizer
setChainLog(int chainLog)

Advanced Compression Option: Set the maximum number of bits for the secondary search structure.

public synchronized ZstdOutputStreamNoFinalizer
setChecksum(boolean useChecksums)

Enable checksums for the compressed stream.

public synchronized ZstdOutputStreamNoFinalizer
setCloseFrameOnFlush(boolean closeOnFlush)

Enable closing the frame on flush.

public synchronized ZstdOutputStreamNoFinalizer
setDict(byte[] dict)

public synchronized ZstdOutputStreamNoFinalizer
public synchronized ZstdOutputStreamNoFinalizer
setHashLog(int hashLog)

Advanced Compression Option: Set the maximum number of bits for a hash table.

public synchronized ZstdOutputStreamNoFinalizer
setJobSize(int jobSize)

Advanced Compression Option: Set the size of each compression job.

public synchronized ZstdOutputStreamNoFinalizer
setLevel(int level)

Set the compression level.

public synchronized ZstdOutputStreamNoFinalizer
setLong(int windowLog)

Enable Long Distance Matching and set the Window size Log.

public synchronized ZstdOutputStreamNoFinalizer
setMinMatch(int minMatch)

Advanced Compression Option: Set the minimum match length.

public synchronized ZstdOutputStreamNoFinalizer
setOverlapLog(int overlapLog)

Advanced Compression Option: Set the amount of data reloaded from the previous job.

public synchronized ZstdOutputStreamNoFinalizer
setSearchLog(int searchLog)

Advanced Compression Option: Set the maximum number of searches in a hash chain or a binary tree using logarithmic scale.

public synchronized ZstdOutputStreamNoFinalizer
setStrategy(int strategy)

Advanced Compression Option: Set the strategy used by a match finder.

public synchronized ZstdOutputStreamNoFinalizer
setTargetLength(int targetLength)

Advanced Compression Option: Set the target match length.

public synchronized ZstdOutputStreamNoFinalizer
setWindowLog(int windowLog)

Advanced Compression Option: Set the maximum number of bits for a match distance.

public synchronized ZstdOutputStreamNoFinalizer
setWorkers(int n)

Enable use of worker threads for parallel compression.

public synchronized void
write(byte[]
the data.
src
,
int
the start offset in the data.
offset
,
int
the number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public void
write(int
the byte.
i
)

Overrides java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.
Inherited from java.io.FilterOutputStream:
write

Field Detail

bufferPoolback to summary
private final BufferPool bufferPool
closeFrameOnFlushback to summary
private boolean closeFrameOnFlush
dstback to summary
private final byte[] dst
dstByteBufferback to summary
private final ByteBuffer dstByteBuffer
dstPosback to summary
private long dstPos
dstSizeback to summary
private static final int dstSize
frameClosedback to summary
private boolean frameClosed
frameStartedback to summary
private boolean frameStarted
isClosedback to summary
private boolean isClosed
srcPosback to summary
private long srcPos
streamback to summary
private final long stream

Constructor Detail

ZstdOutputStreamNoFinalizerback to summary
public ZstdOutputStreamNoFinalizer(OutputStream outStream, int level) throws IOException

create a new compressing OutputStream

Parameters
outStream:OutputStream

the stream to wrap

level:int

the compression level

ZstdOutputStreamNoFinalizerback to summary
public ZstdOutputStreamNoFinalizer(OutputStream outStream) throws IOException

create a new compressing OutputStream

Parameters
outStream:OutputStream

the stream to wrap

ZstdOutputStreamNoFinalizerback to summary
public ZstdOutputStreamNoFinalizer(OutputStream outStream, BufferPool bufferPool, int level) throws IOException

create a new compressing OutputStream

Parameters
outStream:OutputStream

the stream to wrap

bufferPool:BufferPool

the pool to fetch and return buffers

ZstdOutputStreamNoFinalizerback to summary
public ZstdOutputStreamNoFinalizer(OutputStream outStream, BufferPool bufferPool) throws IOException

create a new compressing OutputStream

Parameters
outStream:OutputStream

the stream to wrap

bufferPool:BufferPool

the pool to fetch and return buffers

Method Detail

closeback to summary
public synchronized void close() throws IOException

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.FilterOutputStream.close.

Closes this output stream and releases any system resources associated with the stream.

Exceptions
IOException:
if an I/O error occurs.
closeback to summary
private void close(boolean closeParentStream) throws IOException
closeWithoutClosingParentStreamback to summary
public synchronized void closeWithoutClosingParentStream() throws IOException
compressStreamback to summary
private native int compressStream(long ctx, byte[] dst, int dst_size, byte[] src, int src_size)
createCStreamback to summary
private static native long createCStream()
endStreamback to summary
private native int endStream(long ctx, byte[] dst, int dst_size)
flushback to summary
public synchronized void flush() throws IOException

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes the output

Exceptions
IOException:

Doc from java.io.FilterOutputStream.flush.

if an I/O error occurs.

flushStreamback to summary
private native int flushStream(long ctx, byte[] dst, int dst_size)
freeCStreamback to summary
private static native int freeCStream(long ctx)
recommendedCOutSizeback to summary
public static native long recommendedCOutSize()
resetCStreamback to summary
private native int resetCStream(long ctx)
setChainLogback to summary
public synchronized ZstdOutputStreamNoFinalizer setChainLog(int chainLog) throws 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.

setChecksumback to summary
public synchronized ZstdOutputStreamNoFinalizer setChecksum(boolean useChecksums) throws IOException

Enable checksums for the compressed stream. Default: false

setCloseFrameOnFlushback to summary
public synchronized 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.

setDictback to summary
public synchronized ZstdOutputStreamNoFinalizer setDict(byte[] dict) throws IOException
setDictback to summary
public synchronized ZstdOutputStreamNoFinalizer setDict(ZstdDictCompress dict) throws IOException
setHashLogback to summary
public synchronized ZstdOutputStreamNoFinalizer setHashLog(int hashLog) throws 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.

setJobSizeback to summary
public synchronized ZstdOutputStreamNoFinalizer setJobSize(int jobSize) throws 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.

setLevelback to summary
public synchronized ZstdOutputStreamNoFinalizer setLevel(int level) throws IOException

Set the compression level. Default: Zstd#defaultCompressionLevel()

setLongback to summary
public synchronized ZstdOutputStreamNoFinalizer setLong(int windowLog) throws IOException

Enable Long Distance Matching and set the Window size Log. Values for windowLog outside the range 10-27 will disable and reset LDM

setMinMatchback to summary
public synchronized ZstdOutputStreamNoFinalizer setMinMatch(int minMatch) throws IOException

Advanced Compression Option: Set the minimum match length. See https://facebook.github.io/zstd/zstd_manual.html#Chapter5 for more information.

setOverlapLogback to summary
public synchronized 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.

setSearchLogback to summary
public synchronized ZstdOutputStreamNoFinalizer setSearchLog(int searchLog) throws 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.

setStrategyback to summary
public synchronized ZstdOutputStreamNoFinalizer setStrategy(int strategy) throws 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.

setTargetLengthback to summary
public synchronized 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.

setWindowLogback to summary
public synchronized ZstdOutputStreamNoFinalizer setWindowLog(int windowLog) throws 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.

setWorkersback to summary
public synchronized ZstdOutputStreamNoFinalizer setWorkers(int n) throws IOException

Enable use of worker threads for parallel compression. Default: no worker threads.

writeback to summary
public synchronized void write(byte[] src, int offset, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
src:byte[]

the data.

offset:int

the start offset in the data.

len:int

the number of bytes to write.

Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(int i) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.

The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b).

Implements the abstract write method of OutputStream.

Parameters
i:int

the byte.

Exceptions
IOException:
if an I/O error occurs.