JADE_SL
Class StringACLCodec

java.lang.Object
  extended byJADE_SL.StringACLCodec

public class StringACLCodec
extends java.lang.Object

This class implements the FIPA String codec for ACLMessages. Notice that it is not possible to convey a sequence of bytes over a StringACLCodec because the bytes with the 8th bit ON cannot properly converted into a char.

Version:
$Date: 2003/10/09 13:00:35 $ $Revision: 1.1.1.1 $
Author:
Fabio Bellifemine - CSELT S.p.A.

Field Summary
private static java.lang.String BASE64ENCODING_KEY
          Key of the user-defined parameter used to signal the automatic JADE conversion of the content into Base64 encoding
private static java.lang.String BASE64ENCODING_VALUE
          Value of the user-defined parameter used to signal the automatic JADE conversion of the content into Base64 encoding
private static java.lang.String CONTENT
           
private static java.lang.String CONVERSATION_ID
           
private static java.lang.String ENCODING
           
private static java.lang.String IN_REPLY_TO
           
private static java.lang.String LANGUAGE
           
static java.lang.String NAME
           
private static java.lang.String ONTOLOGY
           
(package private)  java.io.Writer out
           
(package private)  FIPAParser parser
           
private static java.lang.String PROTOCOL
           
private static java.lang.String RECEIVER
           
private static java.lang.String REPLY_BY
           
private static java.lang.String REPLY_TO
           
private static java.lang.String REPLY_WITH
           
private static java.lang.String SENDER
           
 
Constructor Summary
StringACLCodec()
          constructor for the codec.
StringACLCodec(java.io.Reader r, java.io.Writer w)
          constructor for the codec.
 
Method Summary
private  void checkBase64Encoding(ACLMessage msg)
          if there was an automatical Base64 encoding, then it performs automatic decoding.
 FIPAPerformative decode()
          decode and parses the next message from the Reader passed in the constructor.
 byte[] encode(ACLMessage msg)
          If the content of the message is a byteSequence, then this method encodes the content in Base64 and automatically sets the value of the encoding slot.
private static java.lang.String escape(java.lang.String s)
           
 java.lang.String getName()
           
(package private) static java.lang.String toString(ACLMessage msg)
           
 void write(ACLMessage msg)
          encodes the message and writes it into the Writer passed in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

BASE64ENCODING_KEY

private static final java.lang.String BASE64ENCODING_KEY
Key of the user-defined parameter used to signal the automatic JADE conversion of the content into Base64 encoding


BASE64ENCODING_VALUE

private static final java.lang.String BASE64ENCODING_VALUE
Value of the user-defined parameter used to signal the automatic JADE conversion of the content into Base64 encoding


SENDER

private static final java.lang.String SENDER

RECEIVER

private static final java.lang.String RECEIVER

CONTENT

private static final java.lang.String CONTENT

REPLY_WITH

private static final java.lang.String REPLY_WITH

IN_REPLY_TO

private static final java.lang.String IN_REPLY_TO

REPLY_TO

private static final java.lang.String REPLY_TO

LANGUAGE

private static final java.lang.String LANGUAGE

ENCODING

private static final java.lang.String ENCODING

ONTOLOGY

private static final java.lang.String ONTOLOGY

REPLY_BY

private static final java.lang.String REPLY_BY

PROTOCOL

private static final java.lang.String PROTOCOL

CONVERSATION_ID

private static final java.lang.String CONVERSATION_ID

parser

FIPAParser parser

out

java.io.Writer out
Constructor Detail

StringACLCodec

public StringACLCodec()
constructor for the codec. The standard input is used as an input stream of ACL messages. The standard output is used to write encoded ACL messages.


StringACLCodec

public StringACLCodec(java.io.Reader r,
                      java.io.Writer w)
constructor for the codec.

Method Detail

checkBase64Encoding

private void checkBase64Encoding(ACLMessage msg)
if there was an automatical Base64 encoding, then it performs automatic decoding.


decode

public FIPAPerformative decode()
                        throws java.lang.Exception
decode and parses the next message from the Reader passed in the constructor.

Returns:
the ACLMessage
Throws:
ACLCodec.CodecException - if any Exception occurs during the parsing/reading operation
java.lang.Exception

write

public void write(ACLMessage msg)
encodes the message and writes it into the Writer passed in the constructor. Notice that this method does not call flush on the writer.


escape

private static java.lang.String escape(java.lang.String s)

toString

static java.lang.String toString(ACLMessage msg)
Returns:
a String encoded message
See Also:
ACLMessage.toString()

encode

public byte[] encode(ACLMessage msg)
If the content of the message is a byteSequence, then this method encodes the content in Base64 and automatically sets the value of the encoding slot.

See Also:
ACLCodec#encode(ACLMessage msg)

getName

public java.lang.String getName()
Returns:
the name of this encoding according to the FIPA specifications


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.