public final class XdrInputStream
extends java.io.FilterInputStream
XdrInputStream is an input stream for reading in data that
is in the XDR format. An XdrInputStream instance is wrapped
around an underlying java.io.InputStream.
This class is not thread-safe.
| Constructor and Description |
|---|
XdrInputStream(java.io.InputStream in)
Create a new instance of
XdrInputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
enableDecompression()
Wraps the underlying stream for zlib decompression.
|
byte[] |
readBuffer()
Read in a byte buffer.
|
void |
readFully(byte[] b,
int off,
int len)
Read a given amount of data from the underlying input stream.
|
int |
readInt()
Read in an
int. |
long |
readLong()
Read in a
long. |
byte[] |
readRawBuffer(int len)
Read in a raw array of bytes.
|
int |
readShort()
Read in a
short. |
java.lang.String |
readString(Encoding encoding)
Read in a
String. |
void |
setCipher(javax.crypto.Cipher cipher)
Wraps the underlying stream for encryption using the provided
cipher. |
int |
skipFully(int numbytes)
Skips the specified number of bytes.
|
int |
skipPadding(int length)
Skips the padding after a buffer of the specified length.
|
public XdrInputStream(java.io.InputStream in)
XdrInputStream.in - The underlying InputStream to read frompublic int skipPadding(int length)
throws java.io.IOException
(4 - length) & 3.length - Length of the previously read bufferjava.io.IOException - IOException if an error occurs while reading from the
underlying input streamXdrOutputStream.writePadding(int, int)public int skipFully(int numbytes)
throws java.io.IOException
numbytes - Number of bytes to skip.numbytes, unless the underlying input stream is closed).java.io.IOException - IOException if an error occurs while reading from the underlying input streampublic byte[] readBuffer()
throws java.io.IOException
java.io.IOException - if an error occurs while reading from the
underlying input streampublic byte[] readRawBuffer(int len)
throws java.io.IOException
len - The number of bytes to readjava.io.IOException - if an error occurs while reading from the
underlying input streampublic java.lang.String readString(Encoding encoding) throws java.io.IOException
String.String that was readjava.io.IOException - if an error occurs while reading from the
underlying input streampublic long readLong()
throws java.io.IOException
long.long that was readjava.io.IOException - if an error occurs while reading from the
underlying input streampublic int readInt()
throws java.io.IOException
int.int that was readjava.io.IOException - if an error occurs while reading from the
underlying input streampublic int readShort()
throws java.io.IOException
short.short that was readjava.io.IOException - if an error occurs while reading from the
underlying input streampublic void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
b, starting from offset
off.b - The byte buffer to hold the data that is readoff - The offset at which to start storing data in blen - The number of bytes to be readjava.io.IOException - if an error occurs while reading from the
underlying input stream@InternalApi public void enableDecompression() throws java.io.IOException
java.io.IOException - If the underlying stream is already set up for decompressionpublic void setCipher(javax.crypto.Cipher cipher)
throws java.io.IOException
cipher.
An implementation wrapping a stream that also implements EncryptedStreamSupport may delegate this call to
that wrapped stream.
cipher - Cipher for the streamjava.io.IOException - If the underlying stream is already wrappedCopyright © 2001-2023 Jaybird (Firebird JDBC) team. All rights reserved.