org.openorb.io
Class ListOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.omg.CORBA.portable.OutputStream
          extended byorg.omg.CORBA_2_3.portable.OutputStream
              extended byorg.openorb.io.ListOutputStream
All Implemented Interfaces:
ExtendedOutputStream

public class ListOutputStream
extends OutputStream
implements ExtendedOutputStream

This implementation of org.omg.CORBA_2_3.portable.InputStream uses a list as it's backing store. All non primative 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 primative 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.2 $ $Date: 2001/08/13 03:47:34 $
Author:
Chris Wood <wood@intalio.com>

Nested Class Summary
static class ListOutputStream.ArrayBlock
          Arrays of primative types are stored in the list within one of these classes.
 
Constructor Summary
ListOutputStream(ORB orb)
          Create new output stream.
ListOutputStream(ORB orb, java.util.List contents)
          Create new output stream with destination list.
 
Method Summary
 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.
 java.util.List getContents()
          Get the contents of the stream.
 int getIndex()
          Get the index into the source.
 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(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(Context ctx, 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, 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(Object value)
           
 void write_octet_array(byte[] val, int off, int len)
           
 void write_octet(byte i)
           
 void write_Principal(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(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, 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 rep_id)
          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
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListOutputStream

public ListOutputStream(ORB orb)
Create new output stream.


ListOutputStream

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

Method Detail

orb

public ORB orb()
Get the orb associated with the stream.

Specified by:
orb in interface ExtendedOutputStream
Overrides:
orb in class OutputStream

create_input_stream

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

getContents

public java.util.List getContents()
Get the contents of the stream.


getIndex

public int getIndex()
Get the index into the source. This value will be meaningless outside the context of this stream and should only be used to pass back to setIndex on a stream created with create_input_stream.


write_boolean

public void write_boolean(boolean i)
Specified by:
write_boolean in class OutputStream

write_boolean_array

public void write_boolean_array(boolean[] val,
                                int off,
                                int len)
Specified by:
write_boolean_array in class OutputStream

write_octet

public void write_octet(byte i)
Specified by:
write_octet in class OutputStream

write_octet_array

public void write_octet_array(byte[] val,
                              int off,
                              int len)
Specified by:
write_octet_array in class OutputStream

write_short

public void write_short(short i)
Specified by:
write_short in class OutputStream

write_short_array

public void write_short_array(short[] val,
                              int off,
                              int len)
Specified by:
write_short_array in class OutputStream

write_ushort

public void write_ushort(short i)
Specified by:
write_ushort in class OutputStream

write_ushort_array

public void write_ushort_array(short[] val,
                               int off,
                               int len)
Specified by:
write_ushort_array in class OutputStream

write_long

public void write_long(int i)
Specified by:
write_long in class OutputStream

write_long_array

public void write_long_array(int[] val,
                             int off,
                             int len)
Specified by:
write_long_array in class OutputStream

write_ulong

public void write_ulong(int i)
Specified by:
write_ulong in class OutputStream

write_ulong_array

public void write_ulong_array(int[] val,
                              int off,
                              int len)
Specified by:
write_ulong_array in class OutputStream

write_longlong

public void write_longlong(long i)
Specified by:
write_longlong in class OutputStream

write_longlong_array

public void write_longlong_array(long[] val,
                                 int off,
                                 int len)
Specified by:
write_longlong_array in class OutputStream

write_ulonglong

public void write_ulonglong(long i)
Specified by:
write_ulonglong in class OutputStream

write_ulonglong_array

public void write_ulonglong_array(long[] val,
                                  int off,
                                  int len)
Specified by:
write_ulonglong_array in class OutputStream

write_float

public void write_float(float i)
Specified by:
write_float in class OutputStream

write_float_array

public void write_float_array(float[] val,
                              int off,
                              int len)
Specified by:
write_float_array in class OutputStream

write_double

public void write_double(double i)
Specified by:
write_double in class OutputStream

write_double_array

public void write_double_array(double[] val,
                               int off,
                               int len)
Specified by:
write_double_array in class OutputStream

write_char

public void write_char(char i)
Specified by:
write_char in class OutputStream

write_char_array

public void write_char_array(char[] val,
                             int off,
                             int len)
Specified by:
write_char_array in class OutputStream

write_wchar

public void write_wchar(char i)
Specified by:
write_wchar in class OutputStream

write_wchar_array

public void write_wchar_array(char[] val,
                              int off,
                              int len)
Specified by:
write_wchar_array in class OutputStream

write_string

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

write_wstring

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

write_Object

public void write_Object(Object value)
Specified by:
write_Object in class OutputStream

write_TypeCode

public void write_TypeCode(TypeCode value)
Specified by:
write_TypeCode in class OutputStream

write_any

public void write_any(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 OutputStream

write_Context

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

Overrides:
write_Context in class OutputStream

write_Principal

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

Overrides:
write_Principal in class OutputStream

write_fixed

public void write_fixed(java.math.BigDecimal value)
Overrides:
write_fixed in class OutputStream

write_fixed

public void write_fixed(java.math.BigDecimal val,
                        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:
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
Throws:
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 OutputStream

write_value

public void write_value(java.io.Serializable value,
                        java.lang.String rep_id)
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 OutputStream

write_value

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

write_value

public void write_value(java.io.Serializable value,
                        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 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 OutputStream

equals

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