|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.acplt.oncrpc.XdrEncodingStream
public abstract class XdrEncodingStream
Defines the abstract base class for all encoding XDR streams. An encoding XDR stream receives data in the form of Java data types and writes it to a data sink (for instance, network or memory buffer) in the platform-independent XDR format.
Derived classes need to implement the xdrEncodeInt(int)
,
xdrEncodeOpaque(byte[])
and
xdrEncodeOpaque(byte[], int, int)
methods to make this complete
mess workable.
Field Summary | |
---|---|
private java.lang.String |
characterEncoding
Encoding to use when serializing strings or null if
the system's default encoding should be used. |
Constructor Summary | |
---|---|
XdrEncodingStream()
|
Method Summary | |
---|---|
void |
beginEncoding(java.net.InetAddress receiverAddress,
int receiverPort)
Begins encoding a new XDR record. |
void |
close()
Closes this encoding XDR stream and releases any system resources associated with this stream. |
void |
endEncoding()
Flushes this encoding XDR stream and forces any buffered output bytes to be written out. |
java.lang.String |
getCharacterEncoding()
Get the character encoding for serializing strings. |
void |
setCharacterEncoding(java.lang.String characterEncoding)
Set the character encoding for serializing strings. |
void |
xdrEncodeBoolean(boolean value)
Encodes (aka "serializes") a boolean and writes it down this XDR stream. |
void |
xdrEncodeBooleanFixedVector(boolean[] value,
int length)
Encodes (aka "serializes") a vector of booleans and writes it down this XDR stream. |
void |
xdrEncodeBooleanVector(boolean[] value)
Encodes (aka "serializes") a vector of booleans and writes it down this XDR stream. |
void |
xdrEncodeByte(byte value)
Encodes (aka "serializes") a byte and write it down this XDR stream. |
void |
xdrEncodeByteFixedVector(byte[] value,
int length)
Encodes (aka "serializes") a vector of bytes, which is nothing more than a series of octets (or 8 bits wide bytes), each packed into its very own 4 bytes (XDR int). |
void |
xdrEncodeByteVector(byte[] value)
Encodes (aka "serializes") a vector of bytes, which is nothing more than a series of octets (or 8 bits wide bytes), each packed into its very own 4 bytes (XDR int). |
void |
xdrEncodeDouble(double value)
Encodes (aka "serializes") a double (which is a 64 bits wide floating point quantity) and write it down this XDR stream. |
void |
xdrEncodeDoubleFixedVector(double[] value,
int length)
Encodes (aka "serializes") a vector of doubles and writes it down this XDR stream. |
void |
xdrEncodeDoubleVector(double[] value)
Encodes (aka "serializes") a vector of doubles and writes it down this XDR stream. |
void |
xdrEncodeDynamicOpaque(byte[] value)
Encodes (aka "serializes") a XDR opaque value, which is represented by a vector of byte values. |
void |
xdrEncodeFloat(float value)
Encodes (aka "serializes") a float (which is a 32 bits wide floating point quantity) and write it down this XDR stream. |
void |
xdrEncodeFloatFixedVector(float[] value,
int length)
Encodes (aka "serializes") a vector of floats and writes it down this XDR stream. |
void |
xdrEncodeFloatVector(float[] value)
Encodes (aka "serializes") a vector of floats and writes it down this XDR stream. |
abstract void |
xdrEncodeInt(int value)
Encodes (aka "serializes") a "XDR int" value and writes it down a XDR stream. |
void |
xdrEncodeIntFixedVector(int[] value,
int length)
Encodes (aka "serializes") a vector of ints and writes it down this XDR stream. |
void |
xdrEncodeIntVector(int[] value)
Encodes (aka "serializes") a vector of ints and writes it down this XDR stream. |
void |
xdrEncodeLong(long value)
Encodes (aka "serializes") a long (which is called a "hyper" in XDR babble and is 64 bits wide) and write it down this XDR stream. |
void |
xdrEncodeLongFixedVector(long[] value,
int length)
Encodes (aka "serializes") a vector of long integers and writes it down this XDR stream. |
void |
xdrEncodeLongVector(long[] value)
Encodes (aka "serializes") a vector of long integers and writes it down this XDR stream. |
void |
xdrEncodeOpaque(byte[] value)
Encodes (aka "serializes") a XDR opaque value, which is represented by a vector of byte values. |
void |
xdrEncodeOpaque(byte[] value,
int length)
Encodes (aka "serializes") a XDR opaque value, which is represented by a vector of byte values. |
abstract void |
xdrEncodeOpaque(byte[] value,
int offset,
int length)
Encodes (aka "serializes") a XDR opaque value, which is represented by a vector of byte values, and starts at offset with a
length of length . |
void |
xdrEncodeShort(short value)
Encodes (aka "serializes") a short (which is a 16 bits wide quantity) and write it down this XDR stream. |
void |
xdrEncodeShortFixedVector(short[] value,
int length)
Encodes (aka "serializes") a vector of short integers and writes it down this XDR stream. |
void |
xdrEncodeShortVector(short[] value)
Encodes (aka "serializes") a vector of short integers and writes it down this XDR stream. |
void |
xdrEncodeString(java.lang.String value)
Encodes (aka "serializes") a string and writes it down this XDR stream. |
void |
xdrEncodeStringFixedVector(java.lang.String[] value,
int length)
Encodes (aka "serializes") a vector of strings and writes it down this XDR stream. |
void |
xdrEncodeStringVector(java.lang.String[] value)
Encodes (aka "serializes") a vector of strings and writes it down this XDR stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String characterEncoding
null
if
the system's default encoding should be used.
Constructor Detail |
---|
public XdrEncodingStream()
Method Detail |
---|
public void beginEncoding(java.net.InetAddress receiverAddress, int receiverPort) throws OncRpcException, java.io.IOException
receiverAddress
- Indicates the receiver of the XDR data. This can
be null
for XDR streams connected permanently to a
receiver (like in case of TCP/IP based XDR streams).receiverPort
- Port number of the receiver.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public void endEncoding() throws OncRpcException, java.io.IOException
endEncoding
is that
calling it is an indication that the current record is finished and any
bytes previously encoded should immediately be written to their intended
destination.
The endEncoding
method of XdrEncodingStream
does nothing.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public void close() throws OncRpcException, java.io.IOException
close
is that it closes the encoding XDR stream. A closed XDR stream cannot
perform encoding operations and cannot be reopened.
The close
method of XdrEncodingStream
does nothing.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public abstract void xdrEncodeInt(int value) throws OncRpcException, java.io.IOException
value
- The int value to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public abstract void xdrEncodeOpaque(byte[] value, int offset, int length) throws OncRpcException, java.io.IOException
offset
with a
length of length
. Only the opaque value is encoded, but
no length indication is preceeding the opaque value, so the receiver
has to know how long the opaque value will be. The encoded data is
always padded to be a multiple of four. If the given length is not a
multiple of four, zero bytes will be used for padding.
Derived classes must ensure that the proper semantic is maintained.
value
- The opaque value to be encoded in the form of a series of
bytes.offset
- Start offset in the data.length
- the number of bytes to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeDynamicOpaque(byte[] value) throws OncRpcException, java.io.IOException
value
- The opaque value to be encoded in the form of a series of
bytes.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeOpaque(byte[] value) throws OncRpcException, java.io.IOException
value
- The opaque value to be encoded in the form of a series of
bytes.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeOpaque(byte[] value, int length) throws OncRpcException, java.io.IOException
value
- The opaque value to be encoded in the form of a series of
bytes.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeByteVector(byte[] value) throws OncRpcException, java.io.IOException
value
- Byte vector to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeByteFixedVector(byte[] value, int length) throws OncRpcException, java.io.IOException
value
- Byte vector to encode.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeByte(byte value) throws OncRpcException, java.io.IOException
value
- Byte value to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeShort(short value) throws OncRpcException, java.io.IOException
value
- Short value to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeLong(long value) throws OncRpcException, java.io.IOException
value
- Long value to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeFloat(float value) throws OncRpcException, java.io.IOException
value
- Float value to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeDouble(double value) throws OncRpcException, java.io.IOException
value
- Double value to encode.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeBoolean(boolean value) throws OncRpcException, java.io.IOException
value
- Boolean value to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeString(java.lang.String value) throws OncRpcException, java.io.IOException
value
- String value to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeShortVector(short[] value) throws OncRpcException, java.io.IOException
value
- short vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeShortFixedVector(short[] value, int length) throws OncRpcException, java.io.IOException
value
- short vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeIntVector(int[] value) throws OncRpcException, java.io.IOException
value
- int vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeIntFixedVector(int[] value, int length) throws OncRpcException, java.io.IOException
value
- int vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeLongVector(long[] value) throws OncRpcException, java.io.IOException
value
- long vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeLongFixedVector(long[] value, int length) throws OncRpcException, java.io.IOException
value
- long vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeFloatVector(float[] value) throws OncRpcException, java.io.IOException
value
- float vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeFloatFixedVector(float[] value, int length) throws OncRpcException, java.io.IOException
value
- float vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeDoubleVector(double[] value) throws OncRpcException, java.io.IOException
value
- double vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeDoubleFixedVector(double[] value, int length) throws OncRpcException, java.io.IOException
value
- double vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeBooleanVector(boolean[] value) throws OncRpcException, java.io.IOException
value
- long vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeBooleanFixedVector(boolean[] value, int length) throws OncRpcException, java.io.IOException
value
- long vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public final void xdrEncodeStringVector(java.lang.String[] value) throws OncRpcException, java.io.IOException
value
- String vector to be encoded.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.public final void xdrEncodeStringFixedVector(java.lang.String[] value, int length) throws OncRpcException, java.io.IOException
value
- String vector to be encoded.length
- of vector to write. This parameter is used as a sanity
check.
OncRpcException
- if an ONC/RPC error occurs.
java.io.IOException
- if an I/O error occurs.
java.lang.IllegalArgumentException
- if the length of the vector does not
match the specified length.public void setCharacterEncoding(java.lang.String characterEncoding)
characterEncoding
- the encoding to use for serializing strings.
If null
, the system's default encoding is to be used.public java.lang.String getCharacterEncoding()
null
, then the system's default encoding is used.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |