public class CompressedInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
buffer
The packet data after it has been un-compressed
|
private java.io.InputStream |
in
The stream we are reading from the server
|
private java.util.zip.Inflater |
inflater
The ZIP inflater used to un-compress packets
|
private Log |
log
Connection logger
|
private byte[] |
packetHeaderBuffer
The buffer to read packet headers into
|
private int |
pos
The position we are reading from
|
private RuntimeProperty<java.lang.Boolean> |
traceProtocol
Connection property reference
|
| Constructor and Description |
|---|
CompressedInputStream(java.io.InputStream streamFromServer,
RuntimeProperty<java.lang.Boolean> traceProtocol,
Log log)
Creates a new CompressedInputStream that reads the given stream from the
server.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
private void |
getNextPacketFromServer()
Retrieves and un-compressed (if necessary) the next packet from the
server.
|
private void |
getNextPacketIfRequired(int numBytes)
Determines if another packet needs to be read from the server to be able
to read numBytes from the stream.
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
private int |
readFully(byte[] b,
int off,
int len) |
long |
skip(long n) |
private byte[] buffer
private java.io.InputStream in
private java.util.zip.Inflater inflater
private RuntimeProperty<java.lang.Boolean> traceProtocol
private Log log
private byte[] packetHeaderBuffer
private int pos
public CompressedInputStream(java.io.InputStream streamFromServer,
RuntimeProperty<java.lang.Boolean> traceProtocol,
Log log)
streamFromServer - original server InputStreamtraceProtocol - "traceProtocol" propertylog - loggerpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionprivate void getNextPacketFromServer()
throws java.io.IOException
java.io.IOException - if an I/O error occursprivate void getNextPacketIfRequired(int numBytes)
throws java.io.IOException
numBytes - the number of bytes to be readjava.io.IOException - if an I/O error occors.public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionprivate final int readFully(byte[] b,
int off,
int len)
throws java.io.IOException
java.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOException