uka.transport
Class BinaryWriter
java.lang.Object
uka.transport.BinaryWriter
- All Implemented Interfaces:
- TransportConstants
- public class BinaryWriter
- extends java.lang.Object
- implements 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 |
writeChar(int data)
|
void |
writeChars(java.lang.String data)
|
void |
writeDouble(double data)
|
void |
writeFloat(float data)
|
protected void |
writeHugeBooleanArray(boolean[] array,
int offset,
int length)
|
protected void |
writeHugeByteArray(byte[] array,
int offset,
int length)
Sends the contents of the byte array b directly
to the underlying output stream. |
protected void |
writeHugeCharArray(char[] array,
int offset,
int length)
|
protected void |
writeHugeDoubleArray(double[] array,
int offset,
int length)
This method is called, if a large double array is
marshaled. |
protected void |
writeHugeFloatArray(float[] array,
int offset,
int length)
|
protected void |
writeHugeIntArray(int[] array,
int offset,
int length)
|
protected void |
writeHugeLongArray(long[] array,
int offset,
int length)
|
protected 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)
|
| 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
BinaryWriter
public BinaryWriter(java.io.OutputStream out)
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
writeHugeByteArray
protected 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
protected void writeHugeIntArray(int[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeCharArray
protected void writeHugeCharArray(char[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeFloatArray
protected void writeHugeFloatArray(float[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeLongArray
protected void writeHugeLongArray(long[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeDoubleArray
protected 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
protected void writeHugeShortArray(short[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
writeHugeBooleanArray
protected void writeHugeBooleanArray(boolean[] array,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException- See Also:
writeHugeDoubleArray(double[], int, int)
write
public void write(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeBoolean
public final void writeBoolean(boolean data)
throws java.io.IOException
- Throws:
java.io.IOException
writeByte
public final void writeByte(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeShort
public final void writeShort(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeChar
public final void writeChar(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeInt
public final void writeInt(int data)
throws java.io.IOException
- Throws:
java.io.IOException
writeLong
public final void writeLong(long data)
throws java.io.IOException
- Throws:
java.io.IOException
writeFloat
public final void writeFloat(float data)
throws java.io.IOException
- Throws:
java.io.IOException
writeDouble
public final void writeDouble(double data)
throws java.io.IOException
- 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
writeChars
public void writeChars(java.lang.String data)
throws java.io.IOException
- 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
flush
public void flush()
throws java.io.IOException
- Throws:
java.io.IOException