org.jacorb.orb
Class CDROutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.omg.CORBA.portable.OutputStream
          extended byorg.omg.CORBA_2_3.portable.OutputStream
              extended byorg.jacorb.orb.CDROutputStream
Direct Known Subclasses:
MessageOutputStream

public class CDROutputStream
extends OutputStream

Version:
$Id: CDROutputStream.java,v 1.104 2006/05/12 14:39:53 alphonse.bendt Exp $ A stream for CDR marshalling.
Author:
Gerald Brose, 1999

Field Summary
protected  byte[] buffer
           
protected  int giop_minor
           
 
Constructor Summary
CDROutputStream()
          OutputStreams created using the empty constructor are used for in memory marshaling, but do not use the ORB's output buffer manager.
CDROutputStream(byte[] buf)
          Class constructor setting the buffer size for the message and the character encoding sets.
CDROutputStream(ORB orb)
          OutputStreams created using this constructor are used also for in memory marshaling, but do use the ORB's output buffer manager
 
Method Summary
 void beginEncapsulatedArray()
          Can be used locally for data type conversions without preceeding call to beginEncapsulation, i.e.
 void beginEncapsulation()
          Start a CDR encapsulation.
 void close()
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          This stream is self-configuring, i.e. configure() is private and only called from the constructor TODO this led to situations were streams weren't configured properly (see callers of configure) so i changed the method to be public.
 InputStream create_input_stream()
          The following operations are from OutputStream *
 void endEncapsulation()
          Terminate the encapsulation by writing its length to its beginning.
protected  void finalize()
           
 byte[] getBufferCopy()
           
 int getGIOPMinor()
           
 void increaseSize(int amount)
          Add amount empty space
 ORB orb()
           
 void reduceSize(int amount)
           
 void reset()
           
 void setBuffer(byte[] b)
           
 void setBufferWithoutReset(byte[] b, int size)
           
 void setCodeSet(int codeSet, int codeSetWide)
           
 void setGIOPMinor(int giop_minor)
           
 int size()
           
 void skip(int step)
           
 void write_abstract_interface(java.lang.Object object)
          Writes an abstract interface to this stream.
 void write_any(Any value)
           
 void write_boolean_array(boolean[] value, int offset, int length)
           
 void write_boolean(boolean value)
           
 void write_char_array(char[] value, int offset, int length)
           
 void write_char(char c)
          Writes char according to specified encoding.
 void write_double_array(double[] value, int offset, int length)
           
 void write_double(double value)
           
 void write_fixed(java.math.BigDecimal value)
           
 void write_float_array(float[] value, int offset, int length)
           
 void write_float(float value)
           
 void write_IOR(IOR ior)
           
 void write_long_array(int[] value, int offset, int length)
           
 void write_long(int value)
           
 void write_longlong_array(long[] value, int offset, int length)
           
 void write_longlong(long value)
           
 void write_Object(Object value)
           
 void write_octet_array(byte[] value, int offset, int length)
           
 void write_octet(byte value)
           
 void write_Principal(Principal value)
           
 void write_short_array(short[] value, int offset, int length)
           
 void write_short(short value)
           
 void write_string(java.lang.String s)
           
 void write_TypeCode(TypeCode value)
           
 void write_ulong_array(int[] value, int offset, int length)
           
 void write_ulong(int value)
           
 void write_ulonglong_array(long[] value, int offset, int length)
           
 void write_ulonglong(long value)
           
 void write_ushort_array(short[] value, int offset, int length)
           
 void write_ushort(short value)
           
 void write_value(java.io.Serializable value)
          Writes the serialized state of `value' to this stream.
 void write_value(java.io.Serializable value, BoxedValueHelper factory)
           
 void write_value(java.io.Serializable value, java.lang.Class clz)
           
 void write_value(java.io.Serializable value, java.lang.String repository_id)
           
 void write_value(TypeCode tc, InputStream in)
          Reads a value of the type indicated by tc from the InputStream in and remarshals it to this CDROutputStream.
 void write_wchar_array(char[] value, int offset, int length)
           
 void write_wchar(char c)
           
 void write_wstring(java.lang.String s)
           
 void write(java.io.OutputStream out, int start, int length)
          write the contents of this CDR stream to the output stream, includes all deferred writes (e.g., for byte arrays)...
 
Methods inherited from class org.omg.CORBA.portable.OutputStream
write_Context, write_fixed, write
 
Methods inherited from class java.io.OutputStream
flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected byte[] buffer

giop_minor

protected int giop_minor
Constructor Detail

CDROutputStream

public CDROutputStream()
OutputStreams created using the empty constructor are used for in memory marshaling, but do not use the ORB's output buffer manager. A stream created with this c'tor is not explicitly configured, i.e. it will use default configuration only


CDROutputStream

public CDROutputStream(ORB orb)
OutputStreams created using this constructor are used also for in memory marshaling, but do use the ORB's output buffer manager


CDROutputStream

public CDROutputStream(byte[] buf)
Class constructor setting the buffer size for the message and the character encoding sets. A stream created with this c'tor is not explicitly configured, i.e. it will use default configuration only!

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
This stream is self-configuring, i.e. configure() is private and only called from the constructor TODO this led to situations were streams weren't configured properly (see callers of configure) so i changed the method to be public. should be fixed. alphonse 11.05.2006

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

orb

public ORB orb()
Overrides:
orb in class OutputStream

write

public void write(java.io.OutputStream out,
                  int start,
                  int length)
           throws java.io.IOException
write the contents of this CDR stream to the output stream, includes all deferred writes (e.g., for byte arrays)... called by, e.g. GIOPConnection to write directly to the wire.

Throws:
java.io.IOException

setCodeSet

public void setCodeSet(int codeSet,
                       int codeSetWide)

setGIOPMinor

public void setGIOPMinor(int giop_minor)

getGIOPMinor

public int getGIOPMinor()

close

public void close()

beginEncapsulation

public final void beginEncapsulation()
Start a CDR encapsulation. All subsequent writes will place data in the encapsulation until endEncapsulation is called. This will write the size of the encapsulation.


beginEncapsulatedArray

public final void beginEncapsulatedArray()
Can be used locally for data type conversions without preceeding call to beginEncapsulation, i.e. without a leading long that indicates the size.


endEncapsulation

public final void endEncapsulation()
Terminate the encapsulation by writing its length to its beginning.


getBufferCopy

public byte[] getBufferCopy()

size

public int size()

reset

public void reset()

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

skip

public final void skip(int step)

reduceSize

public final void reduceSize(int amount)

increaseSize

public final void increaseSize(int amount)
Add amount empty space


setBuffer

public void setBuffer(byte[] b)

setBufferWithoutReset

public void setBufferWithoutReset(byte[] b,
                                  int size)

create_input_stream

public InputStream create_input_stream()
The following operations are from OutputStream *

Specified by:
create_input_stream in class OutputStream

write_any

public final void write_any(Any value)
Specified by:
write_any in class OutputStream

write_boolean

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

write_boolean_array

public final void write_boolean_array(boolean[] value,
                                      int offset,
                                      int length)
Specified by:
write_boolean_array in class OutputStream

write_char

public final void write_char(char c)
Writes char according to specified encoding.

Specified by:
write_char in class OutputStream

write_char_array

public final void write_char_array(char[] value,
                                   int offset,
                                   int length)
Specified by:
write_char_array in class OutputStream

write_string

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

write_wchar

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

write_wchar_array

public final void write_wchar_array(char[] value,
                                    int offset,
                                    int length)
Specified by:
write_wchar_array in class OutputStream

write_wstring

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

write_double

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

write_double_array

public final void write_double_array(double[] value,
                                     int offset,
                                     int length)
Specified by:
write_double_array in class OutputStream

write_fixed

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

write_float

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

write_float_array

public final void write_float_array(float[] value,
                                    int offset,
                                    int length)
Specified by:
write_float_array in class OutputStream

write_long

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

write_long_array

public final void write_long_array(int[] value,
                                   int offset,
                                   int length)
Specified by:
write_long_array in class OutputStream

write_longlong

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

write_longlong_array

public final void write_longlong_array(long[] value,
                                       int offset,
                                       int length)
Specified by:
write_longlong_array in class OutputStream

write_Object

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

write_IOR

public void write_IOR(IOR ior)

write_octet

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

write_octet_array

public final void write_octet_array(byte[] value,
                                    int offset,
                                    int length)
Specified by:
write_octet_array in class OutputStream

write_Principal

public final void write_Principal(Principal value)
Overrides:
write_Principal in class OutputStream

write_short

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

write_short_array

public final void write_short_array(short[] value,
                                    int offset,
                                    int length)
Specified by:
write_short_array in class OutputStream

write_TypeCode

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

write_ulong

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

write_ulong_array

public final void write_ulong_array(int[] value,
                                    int offset,
                                    int length)
Specified by:
write_ulong_array in class OutputStream

write_ulonglong

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

write_ulonglong_array

public final void write_ulonglong_array(long[] value,
                                        int offset,
                                        int length)
Specified by:
write_ulonglong_array in class OutputStream

write_ushort

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

write_ushort_array

public final void write_ushort_array(short[] value,
                                     int offset,
                                     int length)
Specified by:
write_ushort_array in class OutputStream

write_value

public final void write_value(TypeCode tc,
                              InputStream in)
Reads a value of the type indicated by tc from the InputStream in and remarshals it to this CDROutputStream. Called from Any.


write_value

public void write_value(java.io.Serializable value)
Writes the serialized state of `value' to this stream.

Overrides:
write_value in class OutputStream

write_value

public void write_value(java.io.Serializable value,
                        BoxedValueHelper factory)
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,
                        java.lang.String repository_id)
Overrides:
write_value in class OutputStream

write_abstract_interface

public void write_abstract_interface(java.lang.Object object)
Writes an abstract interface to this stream. The abstract interface is written 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:
write_abstract_interface in class OutputStream