org.jacorb.orb

Class CDRInputStream

public class CDRInputStream extends InputStream

Read CDR encoded data

Author: Gerald Brose, FU Berlin $Id: CDRInputStream.java,v 1.115 2007/04/27 19:14:06 francisco Exp $

Field Summary
protected byte[]buffer
indices into the actual buffer
protected intgiop_minor
protected intindex
booleanlittleEndian
protected intpos
Constructor Summary
CDRInputStream(ORB orb, byte[] buf)
CDRInputStream(ORB orb, byte[] buf, boolean littleEndian)
CDRInputStream(byte[] buffer, boolean littleEndian)
Method Summary
intavailable()
voidclose()
voidcloseEncapsulation()
close a CDR encapsulation and restore index and byte order information
byte[]getBufferCopy()
intgetGIOPMinor()
intget_pos()
voidmark(int readLimit)
booleanmarkSupported()
voidopenEncapsulatedArray()
intopenEncapsulation()
open a CDR encapsulation and restore index and byte order information
ORBorb()
intread()
Reads the next byte of data from the input stream.
intread(byte[] b)
Has the effect of read(b, 0, b.length);
intread(byte[] b, int off, int len)
Performs as described by java.io.InputStream.read(byte[], int, int), but never blocks.
Objectread_abstract_interface()
Reads an abstract interface from this stream.
Objectread_abstract_interface(Class clazz)
Reads an abstract interface from this stream.
Anyread_any()
booleanread_boolean()
voidread_boolean_array(boolean[] value, int offset, int length)
arrays
charread_char()
read_char reads a character from the stream.
voidread_char_array(char[] value, int offset, int length)
read_char_array reads an character array from the stream.
doubleread_double()
voidread_double_array(double[] value, int offset, int length)
BigDecimalread_fixed()
BigDecimalread_fixed(short digits, short scale)
floatread_float()
voidread_float_array(float[] value, int offset, int length)
intread_long()
longread_longlong()
voidread_longlong_array(long[] value, int offset, int length)
voidread_long_array(int[] value, int offset, int length)
byteread_octet()
voidread_octet_array(byte[] value, int offset, int length)
Objectread_Object()
Objectread_Object(Class clazz)
Principalread_Principal()
shortread_short()
Read methods for big-endian as well as little endian data input contributed by Mark Allerton
voidread_short_array(short[] value, int offset, int length)
Stringread_string()
read_string reads a string from the buffer.
TypeCoderead_TypeCode()
intread_ulong()
longread_ulonglong()
voidread_ulonglong_array(long[] value, int offset, int length)
voidread_ulong_array(int[] value, int offset, int length)
shortread_ushort()
voidread_ushort_array(short[] value, int offset, int length)
Serializableread_value()
Serializableread_value(String rep_id)
Overrides read_value(java.io.Serializable value) in org.omg.CORBA_2_3.portable.InputStream
Serializableread_value(Serializable value)
Unmarshals a valuetype instance from this stream.
Serializableread_value(Class clz)
Overrides read_value(clz) in org.omg.CORBA_2_3.portable.InputStream
Serializableread_value(BoxedValueHelper factory)
Overrides read_value(factory) in org.omg.CORBA_2_3.portable.InputStream
charread_wchar()
voidread_wchar_array(char[] value, int offset, int length)
Stringread_wstring()
voidregister_value(Serializable value)
Stores `value' into this stream's valueMap.
voidreset()
voidsetCodeSet(int codeSet, int codeSetWide)
voidsetGIOPMinor(int giop_minor)
voidsetLittleEndian(boolean b)
protected voidskip(int distance)
voidupdateMutatorConnection(GIOPConnection connection)
updateMutatorConnection is an accessor that updates the ior mutator.

Field Detail

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 Detail

CDRInputStream

public CDRInputStream(ORB orb, byte[] buf)

CDRInputStream

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

CDRInputStream

public CDRInputStream(byte[] buffer, boolean littleEndian)

Method Detail

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()

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()

read

public int read()
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.

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

Throws: java.io.IOException if stream is closed.

read

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

See Also: (byte[], int, int)

read

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

read_abstract_interface

public 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.

read_abstract_interface

public Object read_abstract_interface(Class clazz)
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.

read_any

public final Any read_any()

read_boolean

public final boolean read_boolean()

read_boolean_array

public final void read_boolean_array(boolean[] value, int offset, int length)
arrays

read_char

public final char read_char()
read_char reads a character from the stream.

Returns: a char value

read_char_array

public final void read_char_array(char[] value, int offset, int length)
read_char_array reads an character array from the stream.

Parameters: value a char[], the result array. offset an int, an offset into value length an int, the length of the array to read

read_double

public final double read_double()

read_double_array

public final void read_double_array(double[] value, int offset, int length)

read_fixed

public final BigDecimal read_fixed()

read_fixed

public final BigDecimal read_fixed(short digits, short scale)

read_float

public final float read_float()

read_float_array

public final void read_float_array(float[] value, int offset, int length)

read_long

public final int read_long()

read_longlong

public final long read_longlong()

read_longlong_array

public final void read_longlong_array(long[] value, int offset, int length)

read_long_array

public final void read_long_array(int[] value, int offset, int length)

read_octet

public final byte read_octet()

read_octet_array

public final void read_octet_array(byte[] value, int offset, int length)

read_Object

public final Object read_Object()

read_Object

public Object read_Object(Class clazz)

read_Principal

public final Principal read_Principal()

read_short

public final short read_short()
Read methods for big-endian as well as little endian data input contributed by Mark Allerton

read_short_array

public final void read_short_array(short[] value, int offset, int length)

read_string

public final String read_string()
read_string reads a string from the buffer. It is optimized for whether it is reading a blank string, and whether codeset translation is active.

Returns: a String value, possibly blank, never null.

read_TypeCode

public final TypeCode read_TypeCode()

read_ulong

public final int read_ulong()

read_ulonglong

public final long read_ulonglong()

read_ulonglong_array

public final void read_ulonglong_array(long[] value, int offset, int length)

read_ulong_array

public final void read_ulong_array(int[] value, int offset, int length)

read_ushort

public final short read_ushort()

read_ushort_array

public final void read_ushort_array(short[] value, int offset, int length)

read_value

public Serializable read_value()

read_value

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

read_value

public Serializable read_value(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

read_value

public Serializable read_value(Class clz)
Overrides read_value(clz) in org.omg.CORBA_2_3.portable.InputStream

read_value

public Serializable read_value(BoxedValueHelper factory)
Overrides read_value(factory) in org.omg.CORBA_2_3.portable.InputStream

read_wchar

public final char read_wchar()

read_wchar_array

public final void read_wchar_array(char[] value, int offset, int length)

read_wstring

public final String read_wstring()

register_value

public void register_value(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()

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)

updateMutatorConnection

public void updateMutatorConnection(GIOPConnection connection)
updateMutatorConnection is an accessor that updates the ior mutator. By making callers pass in a GIOPConnection not a transport this allows callers to not have to call getTransport which would require a synchronized lock. Therefore if the mutator has not been enabled this is effectively a NOP.

Parameters: connection an org.omg.ETF.Connection value