org.codehaus.activemq.message
Interface PacketWriter

All Known Implementing Classes:
AbstractPacketWriter

public interface PacketWriter

Allows instances implementing Packet to written to a DataOutput


Method Summary
 boolean canWrite(Packet packet)
           
 int getPacketType()
          Return the type of Packet
 void writePacket(Packet packet, DataOutput dataOut)
          Write a Packet instance to data output stream
 byte[] writePacketToByteArray(Packet packet)
          Serializes a Packet int a byte array
 

Method Detail

getPacketType

public int getPacketType()
Return the type of Packet

Returns:
integer representation of the type of Packet

canWrite

public boolean canWrite(Packet packet)
Parameters:
packet -
Returns:
true if this PacketWriter can write this type of Packet

writePacket

public void writePacket(Packet packet,
                        DataOutput dataOut)
                 throws IOException
Write a Packet instance to data output stream

Parameters:
packet - the instance to be seralized
dataOut - the output stream
Throws:
IOException - thrown if an error occurs

writePacketToByteArray

public byte[] writePacketToByteArray(Packet packet)
                              throws IOException
Serializes a Packet int a byte array

Parameters:
packet -
Returns:
the byte[]
Throws:
IOException


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