Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.io.InputStream
org.omg.CORBA.portable.InputStream
org.omg.CORBA_2_3.portable.InputStream
gnu.CORBA.CDR.AbstractCdrInput
InputStream
. The primitive types are aligned
on they natural boundaries by implementing the abstract method
align(int boundary)
.
The same class also implements DataInputStream
to read
the object content in a user defined way.
TODO This class uses 16 bits per Unicode character only, as it was until jdk
1.4 inclusive.
Field Summary | |
protected static String |
|
protected InputStream |
|
protected AbstractDataInput |
|
protected CodeSetServiceContext |
|
protected Version |
|
protected ORB |
|
gnuRuntime |
|
Constructor Summary | |
| |
|
Method Summary | |
String[] |
|
abstract void |
|
void |
|
CodeSetServiceContext |
|
long |
|
int |
|
boolean |
|
ORB | |
int |
|
int |
|
int |
|
Object |
|
Object |
|
Object |
|
TypeCode |
|
Serializable |
|
Any | |
void |
|
boolean |
|
void |
|
void |
|
char |
|
void |
|
void |
|
double |
|
void |
|
void |
|
BufferredCdrInput |
|
BigDecimal |
|
float |
|
void |
|
void |
|
int |
|
void |
|
void |
|
long |
|
void |
|
void |
|
byte |
|
void |
|
void |
|
byte[] |
|
short |
|
void |
|
void |
|
String |
|
int |
|
void |
|
void |
|
long |
|
void |
|
void |
|
short |
|
void |
|
void |
|
char |
|
void |
|
void |
|
String |
|
String |
|
void |
|
void |
|
void |
|
abstract void |
|
void | |
void |
|
static char |
|
Methods inherited from class org.omg.CORBA_2_3.portable.InputStream | |
read_abstract_interface , read_value , read_value , read_value , read_value |
Methods inherited from class org.omg.CORBA.portable.InputStream | |
orb , read , read_Context , 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_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 |
Methods inherited from class java.io.InputStream | |
available , close , mark , markSupported , read , read , read , reset , skip |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected static final String UNEXP_EOF
The message, explaining that the exception has been thrown due unexpected end of the input stream. This usually happens the server and client disagree on communication or data representation rules.
- Field Value:
- "Unexpected end of stream"
protected InputStream actual_stream
The input stream, from where the data are actually being read.
protected AbstractDataInput b
This instance is used to convert primitive data types into the byte sequences.
public gnuRuntime runtime
The runtime, associated with this stream. This field is only used when reading and writing value types and filled-in in gnu.CORBA.CDR.Vio.
public AbstractCdrInput()
Creates the stream, requiring the subsequent call ofsetInputStream(InputStream)
.
public AbstractCdrInput(InputStream readFrom)
Creates the stream. The stream reads Big Endian by default.
- Parameters:
readFrom
- a stream to read CORBA input from.
public String[] _truncatable_ids()
This method is required to represent the DataInputStream as a value type object.
- Specified by:
- _truncatable_ids in interface ValueBase
- Returns:
- a single entity "IDL:omg.org/CORBA/DataInputStream:1.0", always.
public abstract void align(int boundary)
Align the curretn position at the given natural boundary.
public void cloneSettings(AbstractCdrInput stream)
Clone all important settings to another stream.
public long gnu_read_ulong()
Reads the CORBA unsigned long (java int), returning the value in the sufficiently large java long.
public int gnu_read_ushort()
Read the unsigned short integer value and return it as java int, sufficiently large to hold all values.
public boolean isBigEndian()
Get the used encoding.
- Returns:
- true for Big Endian, false for Little Endian.
public ORB orb()
Return the associatedORB
.
- Overrides:
- orb in interface InputStream
- Returns:
- the associated
ORB
or null is no such is set.
public int read() throws IOException
Read a single byte directly from the buffer.
- Overrides:
- read in interface InputStream
public int read(byte[] x) throws IOException
Read bytes directly from the buffer.
- Overrides:
- read in interface InputStream
public int read(byte[] x, int ofs, int len) throws IOException
Read bytes directly from the buffer.
- Overrides:
- read in interface InputStream
public Object read_Abstract()
Read the abstract interface. An abstract interface can be either CORBA value type or CORBA object and is returned as an abstract java.lang.Object. As specified in OMG specification, this reads a single boolean and then delegates either toread_Object()
(for false) or toread_Value()
(for true).
- Specified by:
- read_Abstract in interface DataInputStream
- Returns:
- an abstract interface, unmarshaled from the stream
public Object read_Object()
Read the CORBA object. The object to read is represented in the form of the plain (not a string-encoded) IOR profile without the heading endian indicator. The responsible method for reading such data isIOR.read_no_endian
. The returned object is usually casted into the given type using the .narrow method of its helper, despite in some cases the direct cast would also work. The null objects are recognised from the empty profile set. For such objects, null is returned.
- Specified by:
- read_Object in interface DataInputStream
- Overrides:
- read_Object in interface InputStream
- Returns:
- the loaded and constructed object.
public Object read_Object(Class<T> klass)
Read the object that is an instance of the given class. The current implementation delegates functionality to the parameterlessreadObject()
.
- Parameters:
klass
- a class of that this object the instance is.
- Returns:
- the returned object.
public TypeCode read_TypeCode()
Read the type code. The type code format is defined in the CORBA documenation.
- Specified by:
- read_TypeCode in interface DataInputStream
- Overrides:
- read_TypeCode in interface InputStream
public Serializable read_Value()
Read a value type structure from the stream. OMG specification states the writing format is outside the scope of GIOP definition. This implementation uses java serialization mechanism, callingObjectInputStream.readObject
- Specified by:
- read_Value in interface DataInputStream
- Returns:
- an value type structure, unmarshaled from the stream
public Any read_any()
Read the CORBAAny
. This method first reads the type code, then delegates the functionality toAny.read_value(InputStream,TypeCode)
.
- Specified by:
- read_any in interface DataInputStream
- Overrides:
- read_any in interface InputStream
public void read_any_array(AnySeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_any_array in interface DataInputStream
public boolean read_boolean()
Read the boolean, treating any non zero byte as true, zero byte as false.
- Specified by:
- read_boolean in interface DataInputStream
- Overrides:
- read_boolean in interface InputStream
public void read_boolean_array(boolean[] x, int offs, int len)
Read the array of boolean.
- Overrides:
- read_boolean_array in interface InputStream
public void read_boolean_array(BooleanSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_boolean_array in interface DataInputStream
public char read_char()
Read a character using narrow charset encoding. Depending form which encoding is set, this still can be Unicode or ever wider.
- Specified by:
- read_char in interface DataInputStream
- Overrides:
- read_char in interface InputStream
public void read_char_array(char[] x, int offset, int length)
Read a character array, using narrow charset encoding.
- Overrides:
- read_char_array in interface InputStream
public void read_char_array(CharSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_char_array in interface DataInputStream
public double read_double()
Read the double value, IEEE 754 format.
- Specified by:
- read_double in interface DataInputStream
- Overrides:
- read_double in interface InputStream
public void read_double_array(double[] x, int offs, int len)
Read the array of double values, IEEE 754 format.
- Overrides:
- read_double_array in interface InputStream
public void read_double_array(DoubleSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_double_array in interface DataInputStream
public BufferredCdrInput read_encapsulation()
Read the encapsulated stream. If the encapsulated sequence appears to be in the Little endian format, the flag of the returned stream is set to read Little endian.
public BigDecimal read_fixed()
Read the CORBA fixed (the end of thefixed
can be determined by its last byte). The scale is always assumed to be zero.
- Overrides:
- read_fixed in interface InputStream
public float read_float()
Read the float value, IEEE 754 format.
- Specified by:
- read_float in interface DataInputStream
- Overrides:
- read_float in interface InputStream
public void read_float_array(float[] x, int offs, int len)
Read an array of float values, IEEE 754 format.
- Overrides:
- read_float_array in interface InputStream
public void read_float_array(FloatSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_float_array in interface DataInputStream
public int read_long()
Read the CORBA long (java int), high byte first.
- Specified by:
- read_long in interface DataInputStream
- Overrides:
- read_long in interface InputStream
public void read_long_array(int[] x, int offs, int len)
Read an array of CORBA longs (java ints).
- Overrides:
- read_long_array in interface InputStream
public void read_long_array(LongSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_long_array in interface DataInputStream
public long read_longlong()
Read the CORBA long long (java long).
- Specified by:
- read_longlong in interface DataInputStream
- Overrides:
- read_longlong in interface InputStream
public void read_longlong_array(long[] x, int offs, int len)
Read an array of CORBA long longs (java longs).
- Overrides:
- read_longlong_array in interface InputStream
public void read_longlong_array(LongLongSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_longlong_array in interface DataInputStream
public byte read_octet()
Read a single byte.
- Specified by:
- read_octet in interface DataInputStream
- Overrides:
- read_octet in interface InputStream
public void read_octet_array(byte[] x, int offs, int len)
Read the byte array.
- Overrides:
- read_octet_array in interface InputStream
public void read_octet_array(OctetSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_octet_array in interface DataInputStream
public byte[] read_sequence()
Read the length of the byte array as CORBA long and then the array itseld.
public short read_short()
Read the CORBA short integer.
- Specified by:
- read_short in interface DataInputStream
- Overrides:
- read_short in interface InputStream
public void read_short_array(ShortSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_short_array in interface DataInputStream
public void read_short_array(short[] x, int offs, int len)
Read the array of CORBA short integer values.
- Overrides:
- read_short_array in interface InputStream
public String read_string()
Read a singe byte string. The method firs reads the byte array and then calls a constructor to create a string from this array. The character encoding, if previously set, is taken into consideration.
- Specified by:
- read_string in interface DataInputStream
- Overrides:
- read_string in interface InputStream
- Returns:
- a loaded string.
public int read_ulong()
Reads the CORBA unsigned long (java int), delegating functionality toread_long()
.
- Specified by:
- read_ulong in interface DataInputStream
- Overrides:
- read_ulong in interface InputStream
public void read_ulong_array(int[] x, int offs, int len)
Reads the array of CORBA unsigned long (java integer) values, delegating functionality toAbstractCdrInput
.
- Overrides:
- read_ulong_array in interface InputStream
public void read_ulong_array(ULongSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_ulong_array in interface DataInputStream
public long read_ulonglong()
Read the CORBA unsigned long long value, delegating functionality toread_longlong()
. There is no way to return values over the limit of the java signed long in other way than returning the negative value.
- Specified by:
- read_ulonglong in interface DataInputStream
- Overrides:
- read_ulonglong in interface InputStream
public void read_ulonglong_array(long[] x, int offs, int len)
Reads the array of CORBA long long (java long) values, delegating functionality toAbstractCdrInput
.
- Overrides:
- read_ulonglong_array in interface InputStream
public void read_ulonglong_array(ULongLongSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_ulonglong_array in interface DataInputStream
public short read_ushort()
Read the unsigned short integer value. Due strange specification, the returned value must be the short type as well, so the the best solution seems just to delegete functionality to read_short.
- Specified by:
- read_ushort in interface DataInputStream
- Overrides:
- read_ushort in interface InputStream
public void read_ushort_array(UShortSeqHolder holder, int offset, int length)
- Specified by:
- read_ushort_array in interface DataInputStream
public void read_ushort_array(short[] x, int offs, int len)
Read an array of unsigned short values, delegating the functionality toread_short_array
.
- Overrides:
- read_ushort_array in interface InputStream
public char read_wchar()
Reads the wide character using the encoding, specified in the wide_charset.
- Specified by:
- read_wchar in interface DataInputStream
- Overrides:
- read_wchar in interface InputStream
public void read_wchar_array(char[] x, int offset, int length)
Read an array of "wide chars", each representing a two byte Unicode character, high byte first.
- Overrides:
- read_wchar_array in interface InputStream
public void read_wchar_array(WCharSeqHolder holder, int offset, int length)
Read an array. In OMG specification is written that if the data does not fit into the holder value field, that array must be resized. The implementation follows this rule. If the holder value field contains null, it is newly instantiated.
- Specified by:
- read_wchar_array in interface DataInputStream
public String read_wstring()
Reads the string in wide character format (ussually UTF-16, Unicode). Takes the currently set charset into consideration. If the native (UTF-16) encoding is used of the GIOP protocol is before 1.2, delegates functionality to "plain"read_wstring_UTF_16()
.
- Specified by:
- read_wstring in interface DataInputStream
- Overrides:
- read_wstring in interface InputStream
public String read_wstring_UTF_16()
Reads first length of the string and the all characters as an Unicode (UTF-16) characters. Mind that GIOP 1.1 has the extra null character at the end that must be discarded.
public void setBigEndian(boolean use_big_endian)
Set the Big Endian or Little Endian encoding. The stream reads Big Endian by default.
- Parameters:
use_big_endian
- if true, the stream expect the multi-byte data in the form "most significant byte first" (Big Endian). This is the java standard.
public void setInputStream(InputStream readFrom)
Set the input stream that receives the CORBA input.
- Parameters:
readFrom
- the stream.
public abstract void setOffset(int offset)
Set the alignment offset, if the index of the first byte in the stream is different from 0.
public void setVersion(Version giop_version)
Set the GIOP version. Some data types are written differently for the different versions. The default version is 1.0 .