org.jacorb.orb

Class CDRInputStream

Known Direct Subclasses:
MessageInputStream

public class CDRInputStream
extends InputStream

Read CDR encoded data

Author:
Gerald Brose, FU Berlin $Id: CDRInputStream.java,v 1.83 2004/05/06 22:49:06 francisco Exp $

Field Summary

protected byte[]
buffer
indices into the actual buffer
protected int
giop_minor
protected int
index
boolean
littleEndian
protected int
pos

Constructor Summary

CDRInputStream(ORB orb, byte[] buf)
CDRInputStream(ORB orb, byte[] buf, boolean littleEndian)

Method Summary

int
available()
void
close()
void
closeEncapsulation()
close a CDR encapsulation and restore index and byte order information
byte[]
getBufferCopy()
int
getGIOPMinor()
int
get_pos()
void
mark(int readLimit)
boolean
markSupported()
void
openEncapsulatedArray()
int
openEncapsulation()
open a CDR encapsulation and restore index and byte order information
ORB
orb()
int
read()
Reads the next byte of data from the input stream.
int
read(byte[] b)
Has the effect of read(b, 0, b.length);
int
read(byte[] b, int off, int len)
Performs as described by java.io.InputStream.read(byte[], int, int), but never blocks.
Object
read_Object()
Object
read_Object(java.lang.Class clz)
Principal
read_Principal()
Deprecated. Deprecated by CORBA 2.2
TypeCode
read_TypeCode()
java.lang.Object
read_abstract_interface()
Reads an abstract interface from this stream.
java.lang.Object
read_abstract_interface(java.lang.Class clz)
Reads an abstract interface from this stream.
Any
read_any()
boolean
read_boolean()
void
read_boolean_array(boolean[] value, int offset, int length)
arrays
char
read_char()
void
read_char_array(char[] value, int offset, int length)
double
read_double()
void
read_double_array(double[] value, int offset, int length)
java.math.BigDecimal
read_fixed()
Deprecated. Deprecated by CORBA 2.4
float
read_float()
void
read_float_array(float[] value, int offset, int length)
int
read_long()
void
read_long_array(int[] value, int offset, int length)
long
read_longlong()
void
read_longlong_array(long[] value, int offset, int length)
byte
read_octet()
void
read_octet_array(byte[] value, int offset, int length)
short
read_short()
Read methods for big-endian as well as little endian data input contributed by Mark Allerton <MAllerton@img.seagatesoftware.com>
void
read_short_array(short[] value, int offset, int length)
String
read_string()
int
read_ulong()
void
read_ulong_array(int[] value, int offset, int length)
long
read_ulonglong()
void
read_ulonglong_array(long[] value, int offset, int length)
short
read_ushort()
void
read_ushort_array(short[] value, int offset, int length)
java.io.Serializable
read_value()
java.io.Serializable
read_value(String rep_id)
Overrides read_value(java.io.Serializable value) in org.omg.CORBA_2_3.portable.InputStream
java.io.Serializable
read_value(java.io.Serializable value)
Unmarshals a valuetype instance from this stream.
java.io.Serializable
read_value(java.lang.Class clz)
Overrides read_value(clz) in org.omg.CORBA_2_3.portable.InputStream
java.io.Serializable
read_value(BoxedValueHelper factory)
Overrides read_value(factory) in org.omg.CORBA_2_3.portable.InputStream
char
read_wchar()
void
read_wchar_array(char[] value, int offset, int length)
String
read_wstring()
void
register_value(java.io.Serializable value)
Stores `value' into this stream's valueMap.
void
reset()
void
setCodeSet(int codeSet, int codeSetWide)
void
setGIOPMinor(int giop_minor)
void
setLittleEndian(boolean b)
protected void
skip(int distance)

Methods inherited from class org.omg.CORBA_2_3.portable.InputStream

read_abstract_interface, read_abstract_interface, read_value, read_value, read_value, read_value, read_value

Methods inherited from class org.omg.CORBA.portable.InputStream

orb, read, read_Context, read_Object, read_Object, read_Principal, read_TypeCode, read_any, read_boolean, read_boolean_array, read_char, read_char_array, read_double, read_double_array, read_fixed, read_fixed, read_float, read_float_array, read_long, read_long_array, read_longlong, read_longlong_array, read_octet, read_octet_array, read_short, read_short_array, read_string, read_ulong, read_ulong_array, read_ulonglong, read_ulonglong_array, read_ushort, read_ushort_array, read_wchar, read_wchar_array, read_wstring

Field Details

buffer

protected byte[] buffer
indices into the actual buffer


giop_minor

protected int giop_minor


index

protected int index


littleEndian

public boolean littleEndian


pos

protected int pos

Constructor Details

CDRInputStream

public CDRInputStream(ORB orb,
                      byte[] buf)


CDRInputStream

public CDRInputStream(ORB orb,
                      byte[] buf,
                      boolean littleEndian)

Method Details

available

public int available()

Returns:
the number of bytes that can be read (or skipped over) from this input stream. This is not necessarily the number of 'valid' bytes.


close

public void close()
            throws IOException


closeEncapsulation

public final void closeEncapsulation()
close a CDR encapsulation and restore index and byte order information


getBufferCopy

public byte[] getBufferCopy()


getGIOPMinor

public int getGIOPMinor()


get_pos

public int get_pos()


mark

public void mark(int readLimit)


markSupported

public boolean markSupported()


openEncapsulatedArray

public final void openEncapsulatedArray()


openEncapsulation

public final int openEncapsulation()
open a CDR encapsulation and restore index and byte order information


orb

public ORB orb()
Overrides:
orb in interface InputStream


read

public int read()
            throws java.io.IOException
Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.
Overrides:
read in interface InputStream

Returns:
the next byte of data, or -1 if the end of the stream is reached.


read

public int read(byte[] b)
            throws java.io.IOException
Has the effect of read(b, 0, b.length);

See Also:
read


read

public int read(byte[] b,
                int off,
                int len)
            throws java.io.IOException
Performs as described by java.io.InputStream.read(byte[], int, int), but never blocks.


read_Object

public final Object read_Object()
Overrides:
read_Object in interface InputStream


read_Object

public Object read_Object(java.lang.Class clz)
Overrides:
read_Object in interface InputStream


read_Principal

public final Principal read_Principal()

Deprecated. Deprecated by CORBA 2.2

Overrides:
read_Principal in interface InputStream


read_TypeCode

public final TypeCode read_TypeCode()
Overrides:
read_TypeCode in interface InputStream


read_abstract_interface

public java.lang.Object read_abstract_interface()
Reads an abstract interface from this stream. The abstract interface Reads an abstract interface from this stream. The abstract interface appears as a union with a boolean discriminator, which is true if the union contains a CORBA object reference, or false if the union contains a value.
Overrides:
read_abstract_interface in interface InputStream


read_abstract_interface

public java.lang.Object read_abstract_interface(java.lang.Class clz)
Reads an abstract interface from this stream. The abstract interface appears as a union with a boolean discriminator, which is true if the union contains a CORBA object reference, or false if the union contains a value.
Overrides:
read_abstract_interface in interface InputStream


read_any

public final Any read_any()
Overrides:
read_any in interface InputStream


read_boolean

public final boolean read_boolean()
Overrides:
read_boolean in interface InputStream


read_boolean_array

public final void read_boolean_array(boolean[] value,
                                     int offset,
                                     int length)
arrays
Overrides:
read_boolean_array in interface InputStream


read_char

public final char read_char()
Overrides:
read_char in interface InputStream


read_char_array

public final void read_char_array(char[] value,
                                  int offset,
                                  int length)
Overrides:
read_char_array in interface InputStream


read_double

public final double read_double()
Overrides:
read_double in interface InputStream


read_double_array

public final void read_double_array(double[] value,
                                    int offset,
                                    int length)
Overrides:
read_double_array in interface InputStream


read_fixed

public final java.math.BigDecimal read_fixed()

Deprecated. Deprecated by CORBA 2.4

Overrides:
read_fixed in interface InputStream


read_float

public final float read_float()
Overrides:
read_float in interface InputStream


read_float_array

public final void read_float_array(float[] value,
                                   int offset,
                                   int length)
Overrides:
read_float_array in interface InputStream


read_long

public final int read_long()
Overrides:
read_long in interface InputStream


read_long_array

public final void read_long_array(int[] value,
                                  int offset,
                                  int length)
Overrides:
read_long_array in interface InputStream


read_longlong

public final long read_longlong()
Overrides:
read_longlong in interface InputStream


read_longlong_array

public final void read_longlong_array(long[] value,
                                      int offset,
                                      int length)
Overrides:
read_longlong_array in interface InputStream


read_octet

public final byte read_octet()
Overrides:
read_octet in interface InputStream


read_octet_array

public final void read_octet_array(byte[] value,
                                   int offset,
                                   int length)
Overrides:
read_octet_array in interface InputStream


read_short

public final short read_short()
Read methods for big-endian as well as little endian data input contributed by Mark Allerton <MAllerton@img.seagatesoftware.com>
Overrides:
read_short in interface InputStream


read_short_array

public final void read_short_array(short[] value,
                                   int offset,
                                   int length)
Overrides:
read_short_array in interface InputStream


read_string

public final String read_string()
Overrides:
read_string in interface InputStream


read_ulong

public final int read_ulong()
Overrides:
read_ulong in interface InputStream


read_ulong_array

public final void read_ulong_array(int[] value,
                                   int offset,
                                   int length)
Overrides:
read_ulong_array in interface InputStream


read_ulonglong

public final long read_ulonglong()
Overrides:
read_ulonglong in interface InputStream


read_ulonglong_array

public final void read_ulonglong_array(long[] value,
                                       int offset,
                                       int length)
Overrides:
read_ulonglong_array in interface InputStream


read_ushort

public final short read_ushort()
Overrides:
read_ushort in interface InputStream


read_ushort_array

public final void read_ushort_array(short[] value,
                                    int offset,
                                    int length)
Overrides:
read_ushort_array in interface InputStream


read_value

public java.io.Serializable read_value()
Overrides:
read_value in interface InputStream


read_value

public java.io.Serializable read_value(String rep_id)
Overrides read_value(java.io.Serializable value) in org.omg.CORBA_2_3.portable.InputStream


read_value

public java.io.Serializable read_value(java.io.Serializable value)
Unmarshals a valuetype instance from this stream. The value returned is the same value passed in, with all the data unmarshaled (IDL-to-Java Mapping 1.2, August 2002, 1.13.1, p. 1-39). The specified value is an uninitialized value that is added to the ORB's indirection table before unmarshaling (1.21.4.1, p. 1-117). This method is intended to be called from custom valuetype factories. Unlike the other read_value() methods in this class, this method does not expect a GIOP value tag nor a repository id in the stream. Overrides read_value(value) in org.omg.CORBA_2_3.portable.InputStream
Overrides:
read_value in interface InputStream


read_value

public java.io.Serializable read_value(java.lang.Class clz)
Overrides read_value(clz) in org.omg.CORBA_2_3.portable.InputStream
Overrides:
read_value in interface InputStream


read_value

public java.io.Serializable read_value(BoxedValueHelper factory)
Overrides read_value(factory) in org.omg.CORBA_2_3.portable.InputStream
Overrides:
read_value in interface InputStream


read_wchar

public final char read_wchar()
Overrides:
read_wchar in interface InputStream


read_wchar_array

public final void read_wchar_array(char[] value,
                                   int offset,
                                   int length)
Overrides:
read_wchar_array in interface InputStream


read_wstring

public final String read_wstring()
Overrides:
read_wstring in interface InputStream


register_value

public void register_value(java.io.Serializable value)
Stores `value' into this stream's valueMap. This is provided as a callback for value factories, so that a value factory can store an object into the map before actually reading its state. This is essential for unmarshalling recursive values.


reset

public void reset()
            throws IOException


setCodeSet

public void setCodeSet(int codeSet,
                       int codeSetWide)


setGIOPMinor

public void setGIOPMinor(int giop_minor)


setLittleEndian

public final void setLittleEndian(boolean b)


skip

protected final void skip(int distance)