nl.west.aaa
Interface RecordFormat

All Known Implementing Classes:
JObjectFormat, RadiusFormat

public interface RecordFormat

Classes implementing this interface can code Messages to send to a sream and read Messages from a stream.


Method Summary
 Message decodeMessage(byte[] data, Identifier from)
          Read a Message from a byte array.
 Message decodeMessage(java.io.InputStream in, Identifier from)
          Read a Message from a stream.
 byte[] encodeMessage(Message msg)
          Encode a given message.
 

Method Detail

encodeMessage

public byte[] encodeMessage(Message msg)
Encode a given message.

decodeMessage

public Message decodeMessage(java.io.InputStream in,
                             Identifier from)
                      throws java.io.IOException
Read a Message from a stream. The stream should not be closed and no more data than neccesary should be read.
If the stream does not contain this record format null should be returned (no exceptions thrown) and the stream should be reset to where it was before the call, useing mark() and reset(). The stream passed as an argument supports mark() and reset().
Any recordformat should ensure that a "sid" (session id) attribute is present in the message. This attribute is used for matching replies with requests.

decodeMessage

public Message decodeMessage(byte[] data,
                             Identifier from)
Read a Message from a byte array. The data should contain one complete message.
If the data is not a message of this record format, null should be returned (no exceptions thrown).
Any recordformat should ensure that a "sid" (session id) attribute is present in the message. This attribute is used for matching replies with requests.



Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/
2002-05-27