public class Xdr
extends java.lang.Object
| Constructor and Description |
|---|
Xdr(byte[] data)
Build an Xdr object for deserialization.
|
Xdr(int size)
Build an Xdr object for serialization.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean()
Get a boolean from the buffer
|
byte[] |
getBuffer()
Return the entire Xdr buffer
|
byte[] |
getByteArray()
Get a counted array of bytes from the buffer
|
void |
getBytes(int lengthToCopy,
byte[] copyArray,
int copyOffset)
Get bytes from the xdr buffer to the input buffer
|
float |
getFloat()
Get a floating point number from the buffer
|
int |
getInt()
Get an integer from the buffer
|
long |
getLong()
Get a long from the buffer
|
int |
getOffset()
Return the current offset
|
java.util.List<java.nio.ByteBuffer> |
getPayloads() |
int |
getSize()
Return the current size of the XDR buffer
|
java.lang.String |
getString()
Get a string from the buffer
|
long |
getUnsignedInt()
Get an unsigned integer from the buffer Note that Java has no unsigned
integer type so we must return it as a long.
|
int |
getXid() |
void |
putBoolean(boolean b)
Put a boolean into the buffer
|
void |
putByteArray(byte[] b)
Put a counted array of bytes into the buffer.
|
void |
putByteArray(byte[] b,
int len)
Put a counted array of bytes into the buffer
|
void |
putByteArray(byte[] b,
int boff,
int len)
Put a counted array of bytes into the buffer
|
void |
putByteArray(Xdr x)
Put an Xdr buffer into the buffer This is used to encode the RPC
credentials
|
void |
putBytes(byte[] b,
int boff,
int len)
Put a counted array of bytes into the buffer.
|
void |
putFloat(float f)
Put a floating point number into the buffer
|
void |
putInt(int i)
Put an integer into the buffer
|
void |
putLong(long i)
Put a long into the buffer
|
void |
putPayloads(java.util.List<java.nio.ByteBuffer> payloads,
int size)
add payloads, more than one can be added.
|
void |
putString(java.lang.String s)
Put a string into the buffer
|
void |
putUnsignedInt(long i)
Put an unsigned integer into the buffer Note that Java has no unsigned
integer type so we must pass it as a long.
|
void |
setOffset(int offset)
Set the current offset
|
void |
setSize(int size)
Set the current size of the XDR buffer
|
void |
setXid(int xid)
Set xid
|
void |
skip(int count)
Skip a number of bytes.
|
public Xdr(int size)
size - Size of the buffer in bytes.public Xdr(byte[] data)
data - The data for the buffer.public void skip(int count)
count - of the buffer in bytespublic byte[] getBuffer()
public int getOffset()
public void setOffset(int offset)
offset - offset into XDR bufferpublic int getSize()
public void setSize(int size)
size - Size of the buffer in bytespublic int getInt()
public void putInt(int i)
i - Integer to store in XDR buffer.public long getUnsignedInt()
public void putUnsignedInt(long i)
i - unsigned integer to store in XDR buffer.public long getLong()
public void putLong(long i)
i - long to store in XDR bufferpublic boolean getBoolean()
public void putBoolean(boolean b)
b - booleanpublic float getFloat()
public void putFloat(float f)
f - floatpublic java.lang.String getString()
public void putString(java.lang.String s)
s - stringpublic byte[] getByteArray()
public void getBytes(int lengthToCopy,
byte[] copyArray,
int copyOffset)
lengthToCopy - Number of bytes to copy.copyArray - Array to hold the copied data.copyOffset - Where to start the copy.public void putByteArray(byte[] b)
b - byte arraypublic void putByteArray(byte[] b,
int len)
b - byte arraylen - number of bytes to encodepublic void putByteArray(byte[] b,
int boff,
int len)
b - byte arrayboff - offset into byte arraylen - number of bytes to encodepublic void putByteArray(Xdr x)
x - XDR bufferpublic void putBytes(byte[] b,
int boff,
int len)
b - byte arrayboff - offset into byte arraylen - number of bytes to encodepublic int getXid()
public void setXid(int xid)
xid - public void putPayloads(java.util.List<java.nio.ByteBuffer> payloads,
int size)
payloads - size - public java.util.List<java.nio.ByteBuffer> getPayloads()