p2ps.imp.endpoint.TCP
Class ASCIIMessageProtocol

java.lang.Object
  extended byp2ps.imp.endpoint.AbstractMessageProtcol
      extended byp2ps.imp.endpoint.TCP.ASCIIMessageProtocol
All Implemented Interfaces:
MessageProtocolHandler

public class ASCIIMessageProtocol
extends AbstractMessageProtcol

A protocol where messages are seperated by carridge returns (CR), line feeds (LF) or CRLF.

Version:
$Revision: 295 $
Author:
Ian Wang

Constructor Summary
ASCIIMessageProtocol()
           
 
Method Summary
 java.lang.Object[] createReceiveItems(byte[] packet)
           
 java.lang.Object[] createSendPackets(byte[] data)
           
 int readDataItem(byte[] packet, int offset)
          Read a data item from the specified offset
 
Methods inherited from class p2ps.imp.endpoint.AbstractMessageProtcol
addReceivePacket, addSendData, getReceiveData, getSendPacket, isReceiveData, isSendPacket, packetError, packetSent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASCIIMessageProtocol

public ASCIIMessageProtocol()
Method Detail

createSendPackets

public java.lang.Object[] createSendPackets(byte[] data)
Specified by:
createSendPackets in class AbstractMessageProtcol
Returns:
an array of send packets (object array containing byte arrays)

createReceiveItems

public java.lang.Object[] createReceiveItems(byte[] packet)
Specified by:
createReceiveItems in class AbstractMessageProtcol
Returns:
an array of receive messages (object array containing byte arrays)

readDataItem

public int readDataItem(byte[] packet,
                        int offset)
Read a data item from the specified offset

Returns:
the new offset