org.acplt.oncrpc
Class XdrOpaque

java.lang.Object
  extended by org.acplt.oncrpc.XdrOpaque
All Implemented Interfaces:
XdrAble

public class XdrOpaque
extends java.lang.Object
implements XdrAble

Instances of the class XdrOpaque represent (de-)serializeable fixed-size opaque values, which are especially useful in cases where a result with only a single opaque value is expected from a remote function call or only a single opaque value parameter needs to be supplied.

Please note that this class is somewhat modelled after Java's primitive data type wrappers. As for these classes, the XDR data type wrapper classes follow the concept of values with no identity, so you are not allowed to change the value after you've created a value object.


Field Summary
private  byte[] value
          The encapsulated opaque value itself.
 
Constructor Summary
XdrOpaque(byte[] value)
          Constructs and initializes a new XdrOpaque object.
XdrOpaque(int length)
          Constructs and initializes a new XdrOpaque object given only the size of the opaque value.
 
Method Summary
 byte[] opaqueValue()
          Returns the value of this XdrOpaque object as a byte vector.
 void xdrDecode(XdrDecodingStream xdr)
          Decodes -- that is: deserializes -- a XDR opaque from a XDR stream in compliance to RFC 1832.
 void xdrEncode(XdrEncodingStream xdr)
          Encodes -- that is: serializes -- a XDR opaque into a XDR stream in compliance to RFC 1832.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private byte[] value
The encapsulated opaque value itself.

Constructor Detail

XdrOpaque

public XdrOpaque(byte[] value)
Constructs and initializes a new XdrOpaque object.


XdrOpaque

public XdrOpaque(int length)
Constructs and initializes a new XdrOpaque object given only the size of the opaque value.

Parameters:
length - size of opaque value.
Method Detail

opaqueValue

public byte[] opaqueValue()
Returns the value of this XdrOpaque object as a byte vector.

Returns:
The primitive byte[] value of this object.

xdrEncode

public void xdrEncode(XdrEncodingStream xdr)
               throws OncRpcException,
                      java.io.IOException
Encodes -- that is: serializes -- a XDR opaque into a XDR stream in compliance to RFC 1832.

Specified by:
xdrEncode in interface XdrAble
Parameters:
xdr - XDR stream to which information is sent for encoding.
Throws:
OncRpcException - if an ONC/RPC error occurs.
java.io.IOException - if an I/O error occurs.

xdrDecode

public void xdrDecode(XdrDecodingStream xdr)
               throws OncRpcException,
                      java.io.IOException
Decodes -- that is: deserializes -- a XDR opaque from a XDR stream in compliance to RFC 1832.

Specified by:
xdrDecode in interface XdrAble
Parameters:
xdr - XDR stream from which decoded information is retrieved.
Throws:
OncRpcException - if an ONC/RPC error occurs.
java.io.IOException - if an I/O error occurs.