|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
fr.dyade.aaa.agent.MessageOutputStream
fr.dyade.aaa.agent.ByteArrayMessageOutputStream
public abstract class ByteArrayMessageOutputStream
Class used to write messages into a byte array.
This OutputStream allows the replacement of the underlying stream and the serialisation of object through an internal ObjectOutputStream.
Be careful this OutputStream is not synchronized.
Field Summary |
---|
Fields inherited from class fr.dyade.aaa.agent.MessageOutputStream |
---|
buf, compressedFlows, count, logmon, oos |
Constructor Summary | |
---|---|
ByteArrayMessageOutputStream()
Creates a new output stream to write data to an internal byte array with default size. |
|
ByteArrayMessageOutputStream(int size)
Creates a new output stream to write data to an internal byte array with specified size. |
Method Summary | |
---|---|
void |
reset()
Resets this output stream. |
int |
size()
Returns the current size of the buffer. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
void |
writeTo(java.io.OutputStream out)
Writes the complete contents of this byte array output stream to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count) . |
Methods inherited from class fr.dyade.aaa.agent.MessageOutputStream |
---|
getLogger, write, writeHeader, writeInt, writeMessage, writeMessageHeader, writeShort |
Methods inherited from class java.io.OutputStream |
---|
close, flush |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteArrayMessageOutputStream() throws java.io.IOException
java.io.IOException
- if the internal ObjectOutputStream cannot be
correctly initialized.public ByteArrayMessageOutputStream(int size) throws java.io.IOException
size
- the buffer size.
java.lang.IllegalArgumentException
- if size is less than 0.
java.io.IOException
- if the internal ObjectOutputStream cannot be
correctly initialized.Method Detail |
---|
public final void write(int b) throws java.io.IOException
write
in class MessageOutputStream
b
- the byte to be written.
java.io.IOException
- if an I/O error occurs.public final void write(byte[] b, int off, int len) throws java.io.IOException
len
bytes from the specified byte array
starting at offset off
to this output stream.
write
in class MessageOutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
java.io.IOException
- if an I/O error occurs.public final int size()
public final void reset()
Set the count
field of this output stream to zero,
so that all currently accumulated output in the output stream is
discarded. The output stream can be used again, reusing the
already allocated buffer space.
public final void writeTo(java.io.OutputStream out) throws java.io.IOException
out.write(buf, 0, count)
.
out
- the output stream to which to write the data.
java.io.IOException
- if an I/O error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |