- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.ibm.jzos.ZCompressorInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ZCompressorInputStream extends java.io.FilterInputStream
A subclass ofInputStream
that will expand data from an enclosed InputStream containing data that was compressed by the same z/Architecture compression dictionaries. Not thread safe.- Since:
- 2.4.4
- See Also:
ZCompressor
-
-
Constructor Summary
Constructors Constructor Description ZCompressorInputStream(ZCompressor compressor, java.io.InputStream in)
Create a new input stream with default buffer size.ZCompressorInputStream(ZCompressor compressor, java.io.InputStream in, int buflen)
Create a new input stream with the specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
Returns an estimate of the number of bytes that can be read.void
close()
long
getTotalExpandedBytes()
Answer the total number of bytes expanded so far.long
getTotalSourceBytes()
Answer the total number of compressed bytes read so far.void
mark(int limit)
Does nothing, not supported.boolean
markSupported()
Always returns false, mark/reset is not supported.int
read()
int
read(byte[] b)
int
read(byte[] readBuf, int readBufOff, int readBufLen)
void
releaseZCompressorOnClose(boolean value)
Sets a flag that will cause the ZCompressor resources to be released when this OutputStream is closed.void
reset()
This method is not supported and always throws an IOException.long
skip(long n)
This method is not supported and always throws an IOException.
-
-
-
Constructor Detail
-
ZCompressorInputStream
public ZCompressorInputStream(ZCompressor compressor, java.io.InputStream in)
Create a new input stream with default buffer size.- Parameters:
compressor
- the ZCompressor object used to expand datain
- the InputStream containing compressed data
-
ZCompressorInputStream
public ZCompressorInputStream(ZCompressor compressor, java.io.InputStream in, int buflen)
Create a new input stream with the specified buffer size.- Parameters:
compressor
- the ZCompressor object used to expand datain
- the InputStream containing compressed databuflen
- the length of internal compression and expansion buffers
-
-
Method Detail
-
releaseZCompressorOnClose
public void releaseZCompressorOnClose(boolean value)
Sets a flag that will cause the ZCompressor resources to be released when this OutputStream is closed. Defaults tofalse
.
-
getTotalSourceBytes
public long getTotalSourceBytes()
Answer the total number of compressed bytes read so far.- Returns:
- the total number of compressed bytes read so far
-
getTotalExpandedBytes
public long getTotalExpandedBytes()
Answer the total number of bytes expanded so far.- Returns:
- the total number of bytes expanded so far
-
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
- See Also:
InputStream.close()
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read(byte[])
-
read
public int read(byte[] readBuf, int readBufOff, int readBufLen) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read(byte[], int, int)
-
skip
public long skip(long n) throws java.io.IOException
This method is not supported and always throws an IOException.- Overrides:
skip
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- always throws IOException since skip() is not supported- See Also:
InputStream.skip(long)
-
available
public int available() throws java.io.IOException
Returns an estimate of the number of bytes that can be read. Note that this is not in any way an estimate of the amount of expanded data available. A positive integer does indicate, however that more is available.- Overrides:
available
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.available()
-
markSupported
public boolean markSupported()
Always returns false, mark/reset is not supported.- Overrides:
markSupported
in classjava.io.FilterInputStream
- See Also:
InputStream.markSupported()
-
mark
public void mark(int limit)
Does nothing, not supported.- Overrides:
mark
in classjava.io.FilterInputStream
- See Also:
InputStream.mark(int)
-
reset
public void reset() throws java.io.IOException
This method is not supported and always throws an IOException.- Overrides:
reset
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- since mark/reset is not supported- See Also:
InputStream.reset()
-
-