org.openorb.orb.io
Class ListOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.omg.CORBA.portable.OutputStream
          extended by org.omg.CORBA_2_3.portable.OutputStream
              extended by org.openorb.orb.io.ListOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, ExtendedOutputStream

public class ListOutputStream
extends org.omg.CORBA_2_3.portable.OutputStream
implements ExtendedOutputStream

This implementation of org.omg.CORBA_2_3.portable.InputStream uses a list as it's backing store. All non primitive types are stored by reference.

The format of the stored types is a TCKind giving the type of the stored value, followed by the stored value itself within an Object wrapper.

Arrays of primitive types are stored as a TCKind.tk_array, followed by an ArrayBlock object containing the stored data. The array data is stored by reference.

The format of all other types is noted.

Version:
$Revision: 1.8 $ $Date: 2004/02/10 21:02:50 $
Author:
Chris Wood

Constructor Summary
ListOutputStream(org.omg.CORBA.ORB orb)
          Create new output stream.
ListOutputStream(org.omg.CORBA.ORB orb, java.util.List contents)
          Create new output stream with destination list.
 
Method Summary
 org.omg.CORBA.portable.InputStream create_input_stream()
          Create a new input stream from the data inserted into this stream.
 boolean equals(java.lang.Object obj)
          Comparisons to ListInputStreams and ListOutputStreams are possible.
 org.omg.CORBA.ORB orb()
          Get the orb associated with the stream.
 void write_abstract_interface(java.lang.Object object)
          Abstract interfaces are written as a TCKind.tk_abstract_interface kind, followed by a TCKind.tk_objref and the reference for objects or a TCKind.tk_value and the value for valuetypes.
 void write_any(org.omg.CORBA.Any value)
          To copy the any's contents to the stream write it's typecode followed with a call to any.write_value.
 void write_boolean_array(boolean[] val, int off, int len)
           
 void write_boolean(boolean i)
           
 void write_char_array(char[] val, int off, int len)
           
 void write_char(char i)
           
 void write_Context(org.omg.CORBA.Context ctx, org.omg.CORBA.ContextList contexts)
          Contexts are written like an array of strings, with name and value pairs for each context.
 void write_double_array(double[] val, int off, int len)
           
 void write_double(double i)
           
 void write_fixed(java.math.BigDecimal value)
           
 void write_fixed(java.math.BigDecimal val, short digits, short scale)
          Fixes problems in old write_fixed.
 void write_fixed(java.math.BigDecimal val, org.omg.CORBA.TypeCode tc)
          Fixes problems in old write_fixed.
 void write_float_array(float[] val, int off, int len)
           
 void write_float(float i)
           
 void write_long_array(int[] val, int off, int len)
           
 void write_long(int i)
           
 void write_longlong_array(long[] val, int off, int len)
           
 void write_longlong(long i)
           
 void write_Object(org.omg.CORBA.Object value)
           
 void write_octet_array(byte[] val, int off, int len)
           
 void write_octet(byte i)
           
 void write_Principal(org.omg.CORBA.Principal value)
          Deprecated. Deprecated by CORBA 2.2
 void write_short_array(short[] val, int off, int len)
           
 void write_short(short i)
           
 void write_string(java.lang.String i)
           
 void write_TypeCode(org.omg.CORBA.TypeCode value)
           
 void write_ulong_array(int[] val, int off, int len)
           
 void write_ulong(int i)
           
 void write_ulonglong_array(long[] val, int off, int len)
           
 void write_ulonglong(long i)
           
 void write_ushort_array(short[] val, int off, int len)
           
 void write_ushort(short i)
           
 void write_value(java.io.Serializable value)
          Valuetypes are stored as a TCKind.tk_value kind followed by a reference to the value.
 void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper boxhelp)
          Boxed valuetypes are stored as a TCKind.tk_value_box, followed by the box helper, followed by the contents of the valuebox as written by the helper.
 void write_value(java.io.Serializable value, java.lang.Class clz)
           
 void write_value(java.io.Serializable value, java.lang.String repositoryId)
          Valuetypes are stored as a TCKind.tk_value kind followed by a reference to the value.
 void write_wchar_array(char[] val, int off, int len)
           
 void write_wchar(char i)
           
 void write_wstring(java.lang.String i)
           
 
Methods inherited from class org.omg.CORBA.portable.OutputStream
write
 
Methods inherited from class java.io.OutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListOutputStream

public ListOutputStream(org.omg.CORBA.ORB orb)
Create new output stream.


ListOutputStream

public ListOutputStream(org.omg.CORBA.ORB orb,
                        java.util.List contents)
Create new output stream with destination list.

Method Detail

orb

public org.omg.CORBA.ORB orb()
Get the orb associated with the stream.

Specified by:
orb in interface ExtendedOutputStream
Overrides:
orb in class org.omg.CORBA.portable.OutputStream

create_input_stream

public org.omg.CORBA.portable.InputStream create_input_stream()
Create a new input stream from the data inserted into this stream. Both streams will share the list data.

Specified by:
create_input_stream in class org.omg.CORBA.portable.OutputStream

write_boolean

public void write_boolean(boolean i)
Specified by:
write_boolean in class org.omg.CORBA.portable.OutputStream

write_boolean_array

public void write_boolean_array(boolean[] val,
                                int off,
                                int len)
Specified by:
write_boolean_array in class org.omg.CORBA.portable.OutputStream

write_octet

public void write_octet(byte i)
Specified by:
write_octet in class org.omg.CORBA.portable.OutputStream

write_octet_array

public void write_octet_array(byte[] val,
                              int off,
                              int len)
Specified by:
write_octet_array in class org.omg.CORBA.portable.OutputStream

write_short

public void write_short(short i)
Specified by:
write_short in class org.omg.CORBA.portable.OutputStream

write_short_array

public void write_short_array(short[] val,
                              int off,
                              int len)
Specified by:
write_short_array in class org.omg.CORBA.portable.OutputStream

write_ushort

public void write_ushort(short i)
Specified by:
write_ushort in class org.omg.CORBA.portable.OutputStream

write_ushort_array

public void write_ushort_array(short[] val,
                               int off,
                               int len)
Specified by:
write_ushort_array in class org.omg.CORBA.portable.OutputStream

write_long

public void write_long(int i)
Specified by:
write_long in class org.omg.CORBA.portable.OutputStream

write_long_array

public void write_long_array(int[] val,
                             int off,
                             int len)
Specified by:
write_long_array in class org.omg.CORBA.portable.OutputStream

write_ulong

public void write_ulong(int i)
Specified by:
write_ulong in class org.omg.CORBA.portable.OutputStream

write_ulong_array

public void write_ulong_array(int[] val,
                              int off,
                              int len)
Specified by:
write_ulong_array in class org.omg.CORBA.portable.OutputStream

write_longlong

public void write_longlong(long i)
Specified by:
write_longlong in class org.omg.CORBA.portable.OutputStream

write_longlong_array

public void write_longlong_array(long[] val,
                                 int off,
                                 int len)
Specified by:
write_longlong_array in class org.omg.CORBA.portable.OutputStream

write_ulonglong

public void write_ulonglong(long i)
Specified by:
write_ulonglong in class org.omg.CORBA.portable.OutputStream

write_ulonglong_array

public void write_ulonglong_array(long[] val,
                                  int off,
                                  int len)
Specified by:
write_ulonglong_array in class org.omg.CORBA.portable.OutputStream

write_float

public void write_float(float i)
Specified by:
write_float in class org.omg.CORBA.portable.OutputStream

write_float_array

public void write_float_array(float[] val,
                              int off,
                              int len)
Specified by:
write_float_array in class org.omg.CORBA.portable.OutputStream

write_double

public void write_double(double i)
Specified by:
write_double in class org.omg.CORBA.portable.OutputStream

write_double_array

public void write_double_array(double[] val,
                               int off,
                               int len)
Specified by:
write_double_array in class org.omg.CORBA.portable.OutputStream

write_char

public void write_char(char i)
Specified by:
write_char in class org.omg.CORBA.portable.OutputStream

write_char_array

public void write_char_array(char[] val,
                             int off,
                             int len)
Specified by:
write_char_array in class org.omg.CORBA.portable.OutputStream

write_wchar

public void write_wchar(char i)
Specified by:
write_wchar in class org.omg.CORBA.portable.OutputStream

write_wchar_array

public void write_wchar_array(char[] val,
                              int off,
                              int len)
Specified by:
write_wchar_array in class org.omg.CORBA.portable.OutputStream

write_string

public void write_string(java.lang.String i)
Specified by:
write_string in class org.omg.CORBA.portable.OutputStream

write_wstring

public void write_wstring(java.lang.String i)
Specified by:
write_wstring in class org.omg.CORBA.portable.OutputStream

write_Object

public void write_Object(org.omg.CORBA.Object value)
Specified by:
write_Object in class org.omg.CORBA.portable.OutputStream

write_TypeCode

public void write_TypeCode(org.omg.CORBA.TypeCode value)
Specified by:
write_TypeCode in class org.omg.CORBA.portable.OutputStream

write_any

public void write_any(org.omg.CORBA.Any value)
To copy the any's contents to the stream write it's typecode followed with a call to any.write_value.

Specified by:
write_any in class org.omg.CORBA.portable.OutputStream

write_Context

public void write_Context(org.omg.CORBA.Context ctx,
                          org.omg.CORBA.ContextList contexts)
Contexts are written like an array of strings, with name and value pairs for each context.

Overrides:
write_Context in class org.omg.CORBA.portable.OutputStream

write_Principal

public void write_Principal(org.omg.CORBA.Principal value)
Deprecated. Deprecated by CORBA 2.2

Overrides:
write_Principal in class org.omg.CORBA.portable.OutputStream

write_fixed

public void write_fixed(java.math.BigDecimal value)
Overrides:
write_fixed in class org.omg.CORBA.portable.OutputStream

write_fixed

public void write_fixed(java.math.BigDecimal val,
                        org.omg.CORBA.TypeCode tc)
Description copied from interface: ExtendedOutputStream
Fixes problems in old write_fixed. see http://www.omg.org/issues/issue3431.txt

Specified by:
write_fixed in interface ExtendedOutputStream
Throws:
org.omg.CORBA.BAD_PARAM - Typecode is not fixed type or value out of range of type.

write_fixed

public void write_fixed(java.math.BigDecimal val,
                        short digits,
                        short scale)
Description copied from interface: ExtendedOutputStream
Fixes problems in old write_fixed. see http://www.omg.org/issues/issue3431.txt

Specified by:
write_fixed in interface ExtendedOutputStream
Overrides:
write_fixed in class org.omg.CORBA.portable.OutputStream
Throws:
org.omg.CORBA.BAD_PARAM - Value out of range of type.

write_value

public void write_value(java.io.Serializable value)
Valuetypes are stored as a TCKind.tk_value kind followed by a reference to the value. Boxed valuetypes are stored as a TCKind.tk_value_box, followed by the box helper, followed by the contents of the valuebox as written by the helper.

This function will find the valuebox helper if the valuetype is a valuebox type.

Overrides:
write_value in class org.omg.CORBA_2_3.portable.OutputStream

write_value

public void write_value(java.io.Serializable value,
                        java.lang.String repositoryId)
Valuetypes are stored as a TCKind.tk_value kind followed by a reference to the value. Boxed valuetypes are stored as a TCKind.tk_value_box, followed by the box helper, followed by the contents of the valuebox as written by the helper.

This function will find the valuebox helper if the valuetype is a valuebox type.

Overrides:
write_value in class org.omg.CORBA_2_3.portable.OutputStream

write_value

public void write_value(java.io.Serializable value,
                        java.lang.Class clz)
Overrides:
write_value in class org.omg.CORBA_2_3.portable.OutputStream

write_value

public void write_value(java.io.Serializable value,
                        org.omg.CORBA.portable.BoxedValueHelper boxhelp)
Boxed valuetypes are stored as a TCKind.tk_value_box, followed by the box helper, followed by the contents of the valuebox as written by the helper.

This function will find the valuebox helper if the valuetype is a valuebox type.

Overrides:
write_value in class org.omg.CORBA_2_3.portable.OutputStream

write_abstract_interface

public void write_abstract_interface(java.lang.Object object)
Abstract interfaces are written as a TCKind.tk_abstract_interface kind, followed by a TCKind.tk_objref and the reference for objects or a TCKind.tk_value and the value for valuetypes.

Overrides:
write_abstract_interface in class org.omg.CORBA_2_3.portable.OutputStream

equals

public boolean equals(java.lang.Object obj)
Comparisons to ListInputStreams and ListOutputStreams are possible.

Overrides:
equals in class java.lang.Object