|
|||||||||
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.BufferedMessageOutputStream
public abstract class BufferedMessageOutputStream
Class used to send messages through a stream using buffering.
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 | |
---|---|
protected java.io.OutputStream |
out
The underlying output stream. |
Fields inherited from class fr.dyade.aaa.agent.MessageOutputStream |
---|
buf, compressedFlows, count, logmon, oos |
Constructor Summary | |
---|---|
BufferedMessageOutputStream()
Creates a new output stream to write data to an unspecified underlying output stream through a buffer with default size. |
|
BufferedMessageOutputStream(int size)
Creates a new output stream to write data to an unspecified underlying output stream through a buffer with the specified size. |
Method Summary | |
---|---|
private void |
drain()
Writes the internal buffer in underlying output stream. |
void |
flush()
Flushes this output stream. |
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. |
Methods inherited from class fr.dyade.aaa.agent.MessageOutputStream |
---|
getLogger, write, writeHeader, writeInt, writeMessage, writeMessageHeader, writeShort |
Methods inherited from class java.io.OutputStream |
---|
close |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.OutputStream out
Constructor Detail |
---|
public BufferedMessageOutputStream() throws java.io.IOException
java.io.IOException
- if the internal ObjectOutputStream cannot be
correctly initialized.public BufferedMessageOutputStream(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 |
---|
private final void drain() throws java.io.IOException
java.io.IOException
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.
Ordinarily this method stores bytes from the given array into this stream's buffer, flushing the buffer to the underlying output stream as needed. If the requested length is at least as large as this stream's buffer, however, then this method will flush the buffer and write the bytes directly to the underlying 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 void flush() throws java.io.IOException
This forces any buffered output bytes to be written out to the underlying output stream.
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
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 |