jade.lang.acl
Interface ACLCodec

All Known Implementing Classes:
LEAPACLCodec, StringACLCodec

public interface ACLCodec

Abstract interface for converting ACL messages back and forth between Java objects and raw byte sequences, according to a FIPA ACL message representation.

Version:
$Date: 2005-04-15 17:45:02 +0200 (Fri, 15 Apr 2005) $ $Revision: 5669 $
Author:
Giovanni Rimassa - Universita` di Parma

Nested Class Summary
static class ACLCodec.CodecException
          This exception is thrown when some problem occurs in the concrete parsing subsystem accessed through this interface.
 
Field Summary
static java.lang.String DEFAULT_CHARSET
           
 
Method Summary
 ACLMessage decode(byte[] data, java.lang.String charset)
          Recovers an ACLMessage object back from raw data, using the specific message representation to interpret the byte sequence.
 byte[] encode(ACLMessage msg, java.lang.String charset)
          Encodes an ACLMessage object into a byte sequence, according to the specific message representation.
 java.lang.String getName()
          Query the name of the message representation handled by this Codec object.
 

Field Detail

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET
See Also:
Constant Field Values
Method Detail

encode

public byte[] encode(ACLMessage msg,
                     java.lang.String charset)
Encodes an ACLMessage object into a byte sequence, according to the specific message representation.

Parameters:
msg - The ACL message to encode.
charset - Charset encoding to use (e.g. US_ASCII, UTF-8, etc)
Returns:
a byte array, containing the encoded message.

decode

public ACLMessage decode(byte[] data,
                         java.lang.String charset)
                  throws ACLCodec.CodecException
Recovers an ACLMessage object back from raw data, using the specific message representation to interpret the byte sequence.

Parameters:
data - The byte sequence containing the encoded message.
charset - Charset encoding to use (e.g. US_ASCII, UTF-8, etc)
Returns:
A new ACLMessage object, built from the raw data.
Throws:
ACLCodec.CodecException - If some kind of syntax error occurs.

getName

public java.lang.String getName()
Query the name of the message representation handled by this Codec object. The FIPA standard representations have a name starting with "fipa.acl.rep.".

Returns:
The name of the handled ACL message representation.


JADE