|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.acplt.oncrpc.XdrDecodingStream | +--org.acplt.oncrpc.XdrBufferDecodingStream
The XdrBufferDecodingStream
class provides the necessary
functionality to XdrDecodingStream
to retrieve XDR packets from
a byte buffer.
Field Summary | |
private byte[] |
buffer
The buffer which will be filled from the datagram socket and then be used to supply the information when decoding data. |
private int |
bufferHighmark
Index of the last four byte word in the buffer, which has been read in from the datagram socket. |
private int |
bufferIndex
The read pointer is an index into the buffer . |
private int |
encodedLength
Length of encoded data in buffer . |
Constructor Summary | |
XdrBufferDecodingStream(byte[] buffer)
Construct a new XdrUdpDecodingStream object and associate
it with a buffer containing encoded XDR data. |
|
XdrBufferDecodingStream(byte[] buffer,
int encodedLength)
Construct a new XdrUdpDecodingStream object and associate
it with a buffer containing encoded XDR data. |
Method Summary | |
void |
beginDecoding()
Initiates decoding of the next XDR record. |
void |
close()
Closes this decoding XDR stream and releases any system resources associated with this stream. |
void |
endDecoding()
End decoding of the current XDR record. |
java.net.InetAddress |
getSenderAddress()
Returns the Internet address of the sender of the current XDR data. |
int |
getSenderPort()
Returns the port number of the sender of the current XDR data. |
void |
setXdrData(byte[] buffer,
int encodedLength)
Sets the buffer containing encoded XDR data as well as the length of the encoded data. |
int |
xdrDecodeInt()
Decodes (aka "deserializes") a "XDR int" value received from a XDR stream. |
void |
xdrDecodeOpaque(byte[] opaque,
int offset,
int length)
Decodes (aka "deserializes") a XDR opaque value, which is represented by a vector of byte values, and starts at offset with a
length of length . |
byte[] |
xdrDecodeOpaque(int length)
Decodes (aka "deserializes") an opaque value, which is nothing more than a series of octets (or 8 bits wide bytes). |
Methods inherited from class java.lang.Object |
|
Field Detail |
private byte[] buffer
private int encodedLength
buffer
.private int bufferIndex
buffer
.private int bufferHighmark
Constructor Detail |
public XdrBufferDecodingStream(byte[] buffer, int encodedLength)
XdrUdpDecodingStream
object and associate
it with a buffer containing encoded XDR data.buffer
- Buffer containing encoded XDR data.encodedLength
- Length of encoded XDR data within the buffer.encodedLength
is not
a multiple of four.public XdrBufferDecodingStream(byte[] buffer)
XdrUdpDecodingStream
object and associate
it with a buffer containing encoded XDR data.buffer
- Buffer containing encoded XDR data.Method Detail |
public void setXdrData(byte[] buffer, int encodedLength)
buffer
- Buffer containing encoded XDR data.encodedLength
- Length of encoded XDR data within the buffer.encodedLength
is not
a multiple of four.public java.net.InetAddress getSenderAddress()
beginDecoding()
,
otherwise it might return stale information.public int getSenderPort()
beginDecoding()
,
otherwise it might return stale information.public void beginDecoding() throws OncRpcException, java.io.IOException
public void endDecoding() throws OncRpcException, java.io.IOException
endDecoding
is that calling it is an indication that
the current record is no more interesting to the caller and any
allocated data for this record can be freed.
This method overrides XdrDecodingStream.endDecoding()
. It does nothing
more than resetting the buffer pointer (eeek! a pointer in Java!!!) back
to the begin of an empty buffer, so attempts to decode data will fail
until the buffer is filled again.
public void close() throws OncRpcException, java.io.IOException
This implementation frees the allocated buffer.
public int xdrDecodeInt() throws OncRpcException, java.io.IOException
public byte[] xdrDecodeOpaque(int length) throws OncRpcException, java.io.IOException
xdrDecodeOpaque(byte[], int, int)
where
first the length of the opaque value is retrieved from the XDR stream.length
- Length of opaque data to decode.public void xdrDecodeOpaque(byte[] opaque, int offset, int length) throws OncRpcException, java.io.IOException
offset
with a
length of length
. Only the opaque value is decoded, so the
caller has to know how long the opaque value will be. The decoded data
is always padded to be a multiple of four (because that's what the
sender does).opaque
- Byte vector which will receive the decoded opaque value.offset
- Start offset in the byte vector.length
- the number of bytes to decode.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |