org.activemq.io.impl
Class AbstractPacketReader

java.lang.Object
  extended by org.activemq.io.impl.AbstractPacketReader
All Implemented Interfaces:
PacketReader
Direct Known Subclasses:
AbstractPacketMarshaller, ActiveMQMessageReader, BrokerAdminCommandReader, BrokerInfoReader, CachedValueReader, CapacityInfoReader, CapacityInfoRequestReader, CleanupConnectionInfoReader, ConnectionInfoReader, ConsumerInfoReader, DurableUnsubscribeReader, KeepAliveReader, MessageAckReader, ProducerInfoReader, ReceiptReader, SessionInfoReader, TransactionInfoReader, WireFormatInfoReader, XATransactionInfoReader

public abstract class AbstractPacketReader
extends Object
implements PacketReader

Allows instances implementing Packet interface to be deserailized

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  int wireFormatVersion
           
 
Constructor Summary
AbstractPacketReader()
           
 
Method Summary
 void buildPacket(Packet p, DataInput dataIn)
          build a Packet instance from the data input stream
 boolean canRead(int packetType)
           
 int getWireFormatVersion()
           
protected  Object readObject(DataInput dataIn)
          ;
 Packet readPacketFromByteArray(byte[] data)
          Deserailizes a Packet from a byte array
protected  String readUTF(DataInput dataIn)
          pointless method - but mirrors writer
 void setWireFormatVersion(int version)
          Set the wire format version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.activemq.io.impl.PacketReader
createPacket, getPacketType
 

Field Detail

wireFormatVersion

protected int wireFormatVersion
Constructor Detail

AbstractPacketReader

public AbstractPacketReader()
Method Detail

canRead

public boolean canRead(int packetType)
Specified by:
canRead in interface PacketReader
Parameters:
packetType -
Returns:
true if this PacketReader can a Packet of this type

readUTF

protected String readUTF(DataInput dataIn)
                  throws IOException
pointless method - but mirrors writer

Parameters:
dataIn -
Returns:
the String
Throws:
IOException

readObject

protected Object readObject(DataInput dataIn)
                     throws IOException
;

Parameters:
dataIn -
Returns:
object
Throws:
IOException

buildPacket

public void buildPacket(Packet p,
                        DataInput dataIn)
                 throws IOException
build a Packet instance from the data input stream

Specified by:
buildPacket in interface PacketReader
Parameters:
p - A Packet object
dataIn - the data input stream to build the packet from
Throws:
IOException

readPacketFromByteArray

public Packet readPacketFromByteArray(byte[] data)
                               throws IOException
Deserailizes a Packet from a byte array

Specified by:
readPacketFromByteArray in interface PacketReader
Parameters:
data -
Returns:
the deserialized Packet
Throws:
IOException

setWireFormatVersion

public void setWireFormatVersion(int version)
Set the wire format version

Specified by:
setWireFormatVersion in interface PacketReader
Parameters:
version -

getWireFormatVersion

public int getWireFormatVersion()
Specified by:
getWireFormatVersion in interface PacketReader
Returns:
the wire format version


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.