|
|||||||||
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
public abstract class MessageOutputStream
Class used to send messages through a stream.
This OutputStream is a combination between a ByteArrayOutputStream and a BufferedOutputStream. It allows the replacement of the underlying stream and the serialization of object through an internal ObjectOutputStream.
Be careful this OutputStream is not synchronized.
Field Summary | |
---|---|
protected byte[] |
buf
The internal buffer where data is stored. |
protected boolean |
compressedFlows
|
protected int |
count
The number of valid bytes in the buffer. |
protected static org.objectweb.util.monolog.api.Logger |
logmon
Default logger for MessageOutputStream. |
protected java.io.ObjectOutputStream |
oos
The internal ObjectOutputStream needed to serialize the notification. |
private static byte |
STREAM_MAGIC1
|
private static byte |
STREAM_MAGIC2
|
private static byte |
STREAM_VERSION1
|
private static byte |
STREAM_VERSION2
|
Constructor Summary | |
---|---|
MessageOutputStream()
Creates a new output stream to write data to an unspecified underlying output stream through a buffer with default size. |
|
MessageOutputStream(int size)
Creates a new output stream to write data to an unspecified underlying output stream through a buffer with specified size. |
Method Summary | |
---|---|
protected static org.objectweb.util.monolog.api.Logger |
getLogger()
Returns default logger for MessageOutputStream. |
void |
write(byte[] b)
Writes b.length bytes to this output stream. |
abstract void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting
at offset off to this output stream. |
abstract void |
write(int b)
Writes the specified byte to this output stream. |
protected abstract void |
writeHeader()
Writes the protocol header to this output stream. |
protected void |
writeInt(int i)
Writes an int directly to the buffer. |
protected void |
writeMessage(Message msg,
long time)
Writes a message to this output stream. |
protected void |
writeMessageHeader(Message msg)
Writes the message header data to the buffer. |
protected void |
writeShort(short s)
Writes a short directly to the buffer. |
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 |
Field Detail |
---|
protected java.io.ObjectOutputStream oos
protected byte[] buf
protected int count
protected boolean compressedFlows
protected static org.objectweb.util.monolog.api.Logger logmon
private static final byte STREAM_MAGIC1
private static final byte STREAM_MAGIC2
private static final byte STREAM_VERSION1
private static final byte STREAM_VERSION2
Constructor Detail |
---|
public MessageOutputStream() throws java.io.IOException
java.io.IOException
public MessageOutputStream(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 |
---|
protected static org.objectweb.util.monolog.api.Logger getLogger()
public abstract void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte to be written.
java.io.IOException
- if an I/O error occurs.public final void write(byte[] b) throws java.io.IOException
b.length
bytes to this output stream.
This method calls its write
method of three arguments with
the arguments b
, 0
, and b.length
.
write
in class java.io.OutputStream
b
- the data to be written.
java.io.IOException
- if an I/O error occurs.write(byte[], int, int)
public abstract 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 java.io.OutputStream
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.protected final void writeShort(short s)
s
- the data.protected final void writeInt(int i)
i
- the data.protected abstract void writeHeader() throws java.io.IOException
java.io.IOException
protected final void writeMessageHeader(Message msg)
msg
- The message to write out.protected final void writeMessage(Message msg, long time) throws java.io.IOException
msg
- The message to write out.time
- The current time in milliseconds, this parameter
is used to the handling of notification expiration.
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |