com.distinct.rpc
Class XDRRecordOutputStream

java.lang.Object
  |
  +--com.distinct.rpc.XDRStream
        |
        +--com.distinct.rpc.XDROutputStream
              |
              +--com.distinct.rpc.XDRRecordOutputStream

public class XDRRecordOutputStream
extends XDROutputStream

XDROutputStream implements an XDRStream that sends all encoded data to an OutputStream. Use only the "encode" methods of this Stream. All decode operations will fail. Use an instance of XDRInputStream to read data from a Stream.

See Also:
XDRRecordOutputStream

Field Summary
 
Fields inherited from class com.distinct.rpc.XDRStream
alloc_size, buffer, in, out
 
Constructor Summary
XDRRecordOutputStream(java.io.OutputStream outp, int asize)
          Creates a new XDRRecordOutputStream from a Java OutputStream.
 
Method Summary
 void flush()
          Flushes the XDRRecordOutputStream.
 byte get_byte()
          Always throws RPCDecodeError (This is an output stream!).
 byte[] get_bytes(int n)
          Always throws RPCDecodeError (This is an output stream!).
 void put_byte(byte b)
          Writes one byte to the XDRRecordOutputStream.
 void put_bytes(byte[] b, int n)
          Writes a number of bytes to the XDRRecordOutputStream.
 void reset()
          Resets the stream.
 
Methods inherited from class com.distinct.rpc.XDROutputStream
get_length
 
Methods inherited from class com.distinct.rpc.XDRStream
dump, get_data, xdr_decode_boolean, xdr_decode_char, xdr_decode_double, xdr_decode_float, xdr_decode_int, xdr_decode_long, xdr_decode_opaque, xdr_decode_opaque, xdr_decode_short, xdr_decode_string, xdr_decode_string, xdr_encode_boolean, xdr_encode_char, xdr_encode_double, xdr_encode_float, xdr_encode_int, xdr_encode_long, xdr_encode_opaque, xdr_encode_opaque, xdr_encode_short, xdr_encode_string, xdr_encode_string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XDRRecordOutputStream

public XDRRecordOutputStream(java.io.OutputStream outp,
                             int asize)
Creates a new XDRRecordOutputStream from a Java OutputStream.

Parameters:
outp - The OutputStream where all the encoded data is written to.
Method Detail

put_byte

public void put_byte(byte b)
Writes one byte to the XDRRecordOutputStream. Used by the "encode" methods.

Overrides:
put_byte in class XDROutputStream
Parameters:
b - The byte to be written.

put_bytes

public void put_bytes(byte[] b,
                      int n)
Writes a number of bytes to the XDRRecordOutputStream. Used by the "encode" methods.

Overrides:
put_bytes in class XDROutputStream
Parameters:
b - The bytes to be written (starting from index 0).
n - The number of bytes to be written.

get_byte

public byte get_byte()
              throws RPCError
Always throws RPCDecodeError (This is an output stream!).

Overrides:
get_byte in class XDRStream
Returns:
Byte read.
Throws:
RPCError - When the calls fails because of timeout, empty stream or other input error.

get_bytes

public byte[] get_bytes(int n)
                 throws RPCError
Always throws RPCDecodeError (This is an output stream!).

Overrides:
get_bytes in class XDRStream
Parameters:
n - The number of bytes to be read.
Returns:
Bytes read.
Throws:
RPCError - When the calls fails because of timeout, empty stream or other input error.

flush

public void flush()
Flushes the XDRRecordOutputStream.


reset

public void reset()
Resets the stream.

Overrides:
reset in class XDROutputStream