Package com.github.luben.zstd
Class ZstdInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.github.luben.zstd.ZstdInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ZstdInputStream extends java.io.FilterInputStream
InputStream filter that decompresses the data provided by the underlying InputStream using Zstd compression. It does not support mark/reset methods
-
-
Field Summary
Fields Modifier and Type Field Description private ZstdInputStreamNoFinalizer
inner
-
Constructor Summary
Constructors Constructor Description ZstdInputStream(java.io.InputStream inStream)
create a new decompressing InputStreamZstdInputStream(java.io.InputStream inStream, BufferPool bufferPool)
create a new decompressing InputStream
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
available()
void
close()
protected void
finalize()
boolean
getContinuous()
boolean
markSupported()
int
read()
int
read(byte[] dst, int offset, int len)
static long
recommendedDInSize()
static long
recommendedDOutSize()
ZstdInputStream
setContinuous(boolean b)
Don't break on unfinished frames Use case: decompressing files that are not yet finished writing and compressingZstdInputStream
setDict(byte[] dict)
ZstdInputStream
setDict(ZstdDictDecompress dict)
void
setFinalize(boolean finalize)
Deprecated.If you don't rely on finalizers, use `ZstdInputStreamNoFinalizer` instead, instances of `ZstdInputStream` will always try to close/release in the finalizer.ZstdInputStream
setLongMax(int windowLogMax)
long
skip(long numBytes)
-
-
-
Field Detail
-
inner
private ZstdInputStreamNoFinalizer inner
-
-
Constructor Detail
-
ZstdInputStream
public ZstdInputStream(java.io.InputStream inStream) throws java.io.IOException
create a new decompressing InputStream- Parameters:
inStream
- the stream to wrap- Throws:
java.io.IOException
-
ZstdInputStream
public ZstdInputStream(java.io.InputStream inStream, BufferPool bufferPool) throws java.io.IOException
create a new decompressing InputStream- Parameters:
inStream
- the stream to wrapbufferPool
- the pool to fetch and return buffers- Throws:
java.io.IOException
-
-
Method Detail
-
setFinalize
@Deprecated public void setFinalize(boolean finalize)
Deprecated.If you don't rely on finalizers, use `ZstdInputStreamNoFinalizer` instead, instances of `ZstdInputStream` will always try to close/release in the finalizer.Enable or disable class finalizers- Parameters:
finalize
- default `true` - finalizers are enabled
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
recommendedDInSize
public static long recommendedDInSize()
-
recommendedDOutSize
public static long recommendedDOutSize()
-
setContinuous
public ZstdInputStream setContinuous(boolean b)
Don't break on unfinished frames Use case: decompressing files that are not yet finished writing and compressing
-
getContinuous
public boolean getContinuous()
-
setDict
public ZstdInputStream setDict(byte[] dict) throws java.io.IOException
- Throws:
java.io.IOException
-
setDict
public ZstdInputStream setDict(ZstdDictDecompress dict) throws java.io.IOException
- Throws:
java.io.IOException
-
setLongMax
public ZstdInputStream setLongMax(int windowLogMax) throws java.io.IOException
- Throws:
java.io.IOException
-
read
public int read(byte[] dst, int offset, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long numBytes) throws java.io.IOException
- Overrides:
skip
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.FilterInputStream
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-