public class CompressionSplittedInputStream
extends java.io.FilterInputStream
InputStream
wrapper that analyzes X Protocol frames and, if compressed, routes them to a secondary compressor-able InputStream
that also
knows how to rebuild uncompressed X Protocol frames from compressed ones.Constructor and Description |
---|
CompressionSplittedInputStream(java.io.InputStream in,
CompressorStreamsFactory streamsFactory) |
Modifier and Type | Method and Description |
---|---|
int |
available()
Same as
InputStream.available() , except that the exact number of bytes that can be read from the underlying InputStream may not be
accurate until it is known if the next bytes contain compressed data or not. |
void |
close()
Closes this stream.
|
int |
read()
Forwards the read to
read(byte[], int, int) . |
int |
read(byte[] b)
Forwards the read to
read(byte[], int, int) . |
int |
read(byte[] b,
int off,
int len)
Reads bytes from the underlying
InputStream either from the one that gets data directly from the original source InputStream or from
a compressor able InputStream , if reading of a compressed X Protocol frame is in progress. |
int |
readFully(byte[] b)
Reads the number of bytes required to fill the given buffer from the underlying
InputStream , blocking if needed. |
public CompressionSplittedInputStream(java.io.InputStream in, CompressorStreamsFactory streamsFactory)
public int available() throws java.io.IOException
InputStream.available()
, except that the exact number of bytes that can be read from the underlying InputStream
may not be
accurate until it is known if the next bytes contain compressed data or not.available
in class java.io.FilterInputStream
java.io.IOException
FilterInputStream.available()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.io.IOException
FilterInputStream.close()
public int read() throws java.io.IOException
read(byte[], int, int)
.read
in class java.io.FilterInputStream
java.io.IOException
FilterInputStream.read()
public int read(byte[] b) throws java.io.IOException
read(byte[], int, int)
.read
in class java.io.FilterInputStream
java.io.IOException
FilterInputStream.read(byte[])
public int read(byte[] b, int off, int len) throws java.io.IOException
InputStream
either from the one that gets data directly from the original source InputStream
or from
a compressor able InputStream
, if reading of a compressed X Protocol frame is in progress.read
in class java.io.FilterInputStream
java.io.IOException
FilterInputStream.read(byte[], int, int)
public int readFully(byte[] b) throws java.io.IOException
InputStream
, blocking if needed.b
- the buffer into which the data is read.-1
if there is no more data because the end of the stream has been reached.java.io.IOException
- if any of the underlying I/O operations fail.