public class XdrDataInputStream
extends java.io.DataInputStream
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_DEPTH
Default maximum decoding depth to prevent stack overflow from deeply nested structures.
|
| Constructor and Description |
|---|
XdrDataInputStream(java.io.InputStream in)
Creates a XdrDataInputStream that uses the specified underlying InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getRemainingInputLen()
Returns the remaining input length if known, -1 otherwise.
|
int |
read() |
double[] |
readDoubleArray()
Deprecated.
This method does not validate the array length and may cause OutOfMemoryError or
NegativeArraySizeException with untrusted input. Use generated XDR type decoders instead
which include proper validation.
|
float[] |
readFloatArray()
Deprecated.
This method does not validate the array length and may cause OutOfMemoryError or
NegativeArraySizeException with untrusted input. Use generated XDR type decoders instead
which include proper validation.
|
int[] |
readIntArray()
Deprecated.
This method does not validate the array length and may cause OutOfMemoryError or
NegativeArraySizeException with untrusted input. Use generated XDR type decoders instead
which include proper validation.
|
void |
readPaddedData(byte[] b,
int off,
int len)
Reads exactly len bytes of XDR opaque/string data, handling short reads, then reads and
validates padding bytes to maintain 4-byte alignment.
|
boolean |
readXdrBoolean()
Reads an XDR boolean value from the stream.
|
void |
setMaxInputLen(int maxInputLen)
Maximum input length, -1 if unknown.
|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytespublic static final int DEFAULT_MAX_DEPTH
public XdrDataInputStream(java.io.InputStream in)
in - the specified input streampublic int getRemainingInputLen()
public boolean readXdrBoolean()
throws java.io.IOException
java.io.IOException - if the value is not 0 or 1, or if an I/O error occurs@Deprecated
public int[] readIntArray()
throws java.io.IOException
java.io.IOException@Deprecated
public float[] readFloatArray()
throws java.io.IOException
java.io.IOException@Deprecated
public double[] readDoubleArray()
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic void readPaddedData(byte[] b,
int off,
int len)
throws java.io.IOException
b - the buffer into which the data is readoff - the start offset in array b at which the data is writtenlen - the number of bytes to readjava.io.IOException - if an I/O error occurs or EOF is reached before reading len bytespublic void setMaxInputLen(int maxInputLen)