uka.transport
Class BinaryOutputStream
java.lang.Object
java.io.OutputStream
uka.transport.BinaryOutputStream
- All Implemented Interfaces:
- java.io.DataOutput, TransportConstants
- Direct Known Subclasses:
- MarshalStream
- public class BinaryOutputStream
- extends java.io.OutputStream
- implements java.io.DataOutput, TransportConstants
|
Field Summary |
protected byte[] |
buf
|
protected int |
bufcnt
|
protected java.io.OutputStream |
out
|
| Fields inherited from interface uka.transport.TransportConstants |
REQUEST_MAX, REQUEST_MAX_boolean, REQUEST_MAX_byte, REQUEST_MAX_char, REQUEST_MAX_double, REQUEST_MAX_float, REQUEST_MAX_int, REQUEST_MAX_long, REQUEST_MAX_short, SIZEOF_boolean, SIZEOF_byte, SIZEOF_char, SIZEOF_double, SIZEOF_float, SIZEOF_int, SIZEOF_long, SIZEOF_short, TC_ANONYMOUS, TC_DEFAULT, TC_EXCEPTION, TC_NEW, TC_NULL, TC_REFERENCE, TC_REPLACEMENT, TC_RESET, TC_RESETTYPE, TC_TYPE, TC_USER |
|
Method Summary |
void |
close()
|
void |
deliver(int length)
|
protected void |
drain()
|
void |
flush()
|
byte[] |
getBuffer()
|
int |
getPosition()
|
void |
reserve(int length)
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int data)
|
void |
writeBoolean(boolean data)
|
void |
writeByte(int data)
|
void |
writeBytes(java.lang.String s)
|
void |
writeChar(int data)
|
void |
writeChars(java.lang.String data)
|
void |
writeDouble(double data)
|
void |
writeFloat(float data)
|
void |
writeHugeBooleanArray(boolean[] array,
int offset,
int length)
|
void |
writeHugeByteArray(byte[] array,
int offset,
int length)
Sends the contents of the byte array b directly
to the underlying output stream. |
void |
writeHugeCharArray(char[] array,
int offset,
int length)
|
void |
writeHugeDoubleArray(double[] array,
int offset,
int length)
This method is called, if a large double array is
marshaled. |
void |
writeHugeFloatArray(float[] array,
int offset,
int length)
|
void |
writeHugeIntArray(int[] array,
int offset,
int length)
|
void |
writeHugeLongArray(long[] array,
int offset,
int length)
|
void |
writeHugeShortArray(short[] array,
int offset,
int length)
|
void |
writeInt(int data)
|
void |
writeLong(long data)
|
void |
writeShort(int data)
|
void |
writeUnsignedByte(int data)
|
void |
writeUnsignedShort(int data)
|
void |
writeUTF(java.lang.String s)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
protected java.io.OutputStream out
bufcnt
protected int bufcnt
buf
protected byte[] buf
BinaryOutputStream
public BinaryOutputStream(java.io.OutputStream out)
write
public void write(int data)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
writeHugeByteArray
public void writeHugeByteArray(byte[] array,
int offset,
int length)
throws java.io.IOException
- Sends the contents of the byte array
b directly
to the underlying output stream. A subclass might wish to
limit the maximal buffer size that is sent in one write
operation. To do this, this method must be overridden. Even
when overriding this method, the underlying output stream must
be aware of receiving send buffers of the size up to
REQUEST_MAX bytes.
- Throws:
java.io.IOException
writeHugeIntArray
public void writeHugeIntArray(int[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeCharArray
public void writeHugeCharArray(char[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeFloatArray
public void writeHugeFloatArray(float[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeLongArray
public void writeHugeLongArray(long[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeDoubleArray
public void writeHugeDoubleArray(double[] array,
int offset,
int length)
throws java.io.IOException
- This method is called, if a large double array is
marshaled. The default implementation converts the double
array into a sequence of bytes by writing it to the internal
buffer, and sending it in segment of at most REQUEST_MAX
bytes. If a subclass is aware of direct marshaling double
arrays, and sending segments larger than REQUEST_MAX bytes,
this method can be overridden accordingly.
An additional assumption can be made in implementations of
this method in subclasses: This method is never called as
first method in a remote method invocation. As consequence,
the receiving side can assume, that the packet delivering the
contents of the array will arrive soon, because the
remote invocation is already on its way.
The default implementation of this method is therefore
conservative, assuming a transport technology with limited
maximum message size. This is contrary to the default
implementation of writeHugeByteArray().
- Throws:
java.io.IOException- See Also:
writeHugeByteArray(byte[], int, int)
writeHugeShortArray
public void writeHugeShortArray(short[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeBooleanArray
public void writeHugeBooleanArray(boolean[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeBoolean
public final void writeBoolean(boolean data)
throws java.io.IOException
- Specified by:
writeBoolean in interface java.io.DataOutput
- Throws:
java.io.IOException
writeByte
public final void writeByte(int data)
throws java.io.IOException
- Specified by:
writeByte in interface java.io.DataOutput
- Throws:
java.io.IOException
writeShort
public final void writeShort(int data)
throws java.io.IOException
- Specified by:
writeShort in interface java.io.DataOutput
- Throws:
java.io.IOException
writeChar
public final void writeChar(int data)
throws java.io.IOException
- Specified by:
writeChar in interface java.io.DataOutput
- Throws:
java.io.IOException
writeInt
public final void writeInt(int data)
throws java.io.IOException
- Specified by:
writeInt in interface java.io.DataOutput
- Throws:
java.io.IOException
writeLong
public final void writeLong(long data)
throws java.io.IOException
- Specified by:
writeLong in interface java.io.DataOutput
- Throws:
java.io.IOException
writeFloat
public final void writeFloat(float data)
throws java.io.IOException
- Specified by:
writeFloat in interface java.io.DataOutput
- Throws:
java.io.IOException
writeDouble
public final void writeDouble(double data)
throws java.io.IOException
- Specified by:
writeDouble in interface java.io.DataOutput
- Throws:
java.io.IOException
writeUnsignedByte
public final void writeUnsignedByte(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeUnsignedShort
public final void writeUnsignedShort(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeBytes
public void writeBytes(java.lang.String s)
throws java.io.IOException
- Specified by:
writeBytes in interface java.io.DataOutput
- Throws:
java.io.IOException
writeUTF
public void writeUTF(java.lang.String s)
throws java.io.IOException
- Specified by:
writeUTF in interface java.io.DataOutput
- Throws:
java.io.IOException
writeChars
public void writeChars(java.lang.String data)
throws java.io.IOException
- Specified by:
writeChars in interface java.io.DataOutput
- Throws:
java.io.IOException
getBuffer
public final byte[] getBuffer()
getPosition
public final int getPosition()
reserve
public final void reserve(int length)
throws java.io.IOException
- Throws:
java.io.IOException
deliver
public final void deliver(int length)
drain
protected final void drain()
throws java.io.IOException
- Throws:
java.io.IOException