public final class MessageOutputStream
extends java.io.FilterOutputStream
The internal buffer will grow to accomodate however much data is written to it.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer
The underlying buffer.
|
protected int |
dataLength
The length of data in the write buffer.
|
Constructor and Description |
---|
MessageOutputStream(java.io.OutputStream out)
Construct a message stream on the given output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Send the message content on the underlying OutputStream.
|
void |
write(byte[] b)
Write the entire array b[] to the internal buffer.
|
void |
write(byte[] b,
int off,
int len)
Write an array of bytes to the internal buffer starting from off, length
len.
|
void |
write(int b)
Write a single byte to the internal buffer.
|
protected byte[] buffer
protected int dataLength
public MessageOutputStream(java.io.OutputStream out)
out
- The underlying OutputStream to write to.public void write(int b)
write
in class java.io.FilterOutputStream
b
- A byte to write.public void write(byte[] b)
write
in class java.io.FilterOutputStream
b
- public void write(byte[] b, int off, int len)
write
in class java.io.FilterOutputStream
b
- off
- len
- public void flush() throws java.io.IOException
The data is sent with a 2 byte length header, high byte first. This is done with one write/flush to the underlying stream.
flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.