org.jacorb.orb

Class CDROutputStream

public class CDROutputStream extends OutputStream

Version: $Id: CDROutputStream.java,v 1.123 2007/04/26 23:07:26 francisco Exp $ A stream for CDR marshalling.

Author: Gerald Brose, 1999

Field Summary
protected byte[]buffer
protected intgiop_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(ORB orb)
OutputStreams created using this constructor are used also for in memory marshaling, but do use the ORB's output buffer manager
CDROutputStream(byte[] buf)
Class constructor setting the buffer size for the message and the character encoding sets.
Method Summary
voidbeginEncapsulatedArray()
Can be used locally for data type conversions without preceeding call to beginEncapsulation, i.e. without a leading long that indicates the size.
voidbeginEncapsulation()
Start a CDR encapsulation.
voidclose()
voidconfigure(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. should be fixed. alphonse 11.05.2006
InputStreamcreate_input_stream()
The following operations are from OutputStream *
voidendEncapsulation()
Terminate the encapsulation by writing its length to its beginning.
protected voidfinalize()
byte[]getBufferCopy()
intgetGIOPMinor()
voidincreaseSize(int amount)
Add amount empty space
ORBorb()
voidreduceSize(int amount)
voidreset()
voidsetBuffer(byte[] b)
voidsetBufferWithoutReset(byte[] b, int size)
voidsetCodeSet(int codeSet, int codeSetWide)
voidsetGIOPMinor(int giop_minor)
intsize()
voidskip(int step)
voidupdateMutatorConnection(GIOPConnection connection)
updateMutatorConnection is an accessor that updates the ior mutator.
voidwrite(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)... called by, e.g.
voidwrite_abstract_interface(Object object)
Writes an abstract interface to this stream.
voidwrite_any(Any value)
voidwrite_boolean(boolean value)
voidwrite_boolean_array(boolean[] value, int offset, int length)
voidwrite_char(char c)
write_char writes a character to the output stream.
voidwrite_char_array(char[] value, int offset, int length)
voidwrite_double(double value)
voidwrite_double_array(double[] value, int offset, int length)
voidwrite_fixed(BigDecimal value, short digits, short scale)
voidwrite_fixed(BigDecimal value)
voidwrite_float(float value)
voidwrite_float_array(float[] value, int offset, int length)
voidwrite_IOR(IOR ior)
voidwrite_long(int value)
voidwrite_longlong(long value)
voidwrite_longlong_array(long[] value, int offset, int length)
voidwrite_long_array(int[] value, int offset, int length)
voidwrite_octet(byte value)
voidwrite_octet_array(byte[] value, int offset, int length)
voidwrite_Object(Object value)
voidwrite_Principal(Principal value)
voidwrite_short(short value)
voidwrite_short_array(short[] value, int offset, int length)
voidwrite_string(String s)
write_string writes a string to the output stream.
voidwrite_TypeCode(TypeCode typeCode)
voidwrite_ulong(int value)
voidwrite_ulonglong(long value)
voidwrite_ulonglong_array(long[] value, int offset, int length)
voidwrite_ulong_array(int[] value, int offset, int length)
voidwrite_ushort(short value)
voidwrite_ushort_array(short[] value, int offset, int length)
voidwrite_value(TypeCode typeCode, InputStream input)
Reads a value of the type indicated by tc from the InputStream in and remarshals it to this CDROutputStream.
voidwrite_value(Serializable value)
Writes the serialized state of `value' to this stream.
voidwrite_value(Serializable value, BoxedValueHelper factory)
voidwrite_value(Serializable value, Class clazz)
voidwrite_value(Serializable value, String repository_id)
voidwrite_wchar(char c)
voidwrite_wchar_array(char[] value, int offset, int length)
voidwrite_wstring(String s)

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

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.

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.

close

public void close()

configure

public void configure(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. should be fixed. alphonse 11.05.2006

create_input_stream

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

endEncapsulation

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

finalize

protected void finalize()

getBufferCopy

public byte[] getBufferCopy()

getGIOPMinor

public int getGIOPMinor()

increaseSize

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

orb

public ORB orb()

reduceSize

public final void reduceSize(int amount)

reset

public void reset()

setBuffer

public void setBuffer(byte[] b)

setBufferWithoutReset

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

setCodeSet

public void setCodeSet(int codeSet, int codeSetWide)

setGIOPMinor

public void setGIOPMinor(int giop_minor)

size

public int size()

skip

public final void skip(int step)

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

write

public void write(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)... called by, e.g. GIOPConnection to write directly to the wire.

write_abstract_interface

public void write_abstract_interface(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.

write_any

public final void write_any(Any value)

write_boolean

public final void write_boolean(boolean value)

write_boolean_array

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

write_char

public final void write_char(char c)
write_char writes a character to the output stream. If codeset translation is active then it will use String and an encoding to get the bytes. It can then do a test for whether to throw DATA_CONVERSION.

Parameters: c a char value

write_char_array

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

write_double

public final void write_double(double value)

write_double_array

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

write_fixed

public final void write_fixed(BigDecimal value, short digits, short scale)

write_fixed

public final void write_fixed(BigDecimal value)

write_float

public final void write_float(float value)

write_float_array

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

write_IOR

public void write_IOR(IOR ior)

write_long

public final void write_long(int value)

write_longlong

public final void write_longlong(long value)

write_longlong_array

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

write_long_array

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

write_octet

public final void write_octet(byte value)

write_octet_array

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

write_Object

public void write_Object(Object value)

write_Principal

public final void write_Principal(Principal value)

write_short

public final void write_short(short value)

write_short_array

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

write_string

public final void write_string(String s)
write_string writes a string to the output stream. It is optimised for whether it is writing a blank string or for whether codeset translation is active.

Parameters: s a String value

write_TypeCode

public final void write_TypeCode(TypeCode typeCode)

write_ulong

public final void write_ulong(int value)

write_ulonglong

public final void write_ulonglong(long value)

write_ulonglong_array

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

write_ulong_array

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

write_ushort

public final void write_ushort(short value)

write_ushort_array

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

write_value

public final void write_value(TypeCode typeCode, InputStream input)
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(Serializable value)
Writes the serialized state of `value' to this stream.

write_value

public void write_value(Serializable value, BoxedValueHelper factory)

write_value

public void write_value(Serializable value, Class clazz)

write_value

public void write_value(Serializable value, String repository_id)

write_wchar

public final void write_wchar(char c)

write_wchar_array

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

write_wstring

public final void write_wstring(String s)