|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a strategy of encoding packets on the wire or on disk using some kind of serialization or wire format.
We use a default efficient format for Java to Java communication but other formats to other systems can be used, such as using simple text strings when talking to JavaScript or coming up with other formats for talking to C / C# languages or proprietary messaging systems we wish to interface with at the wire level etc.
Method Summary | |
boolean |
canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version |
WireFormat |
copy()
Creates a new copy of this wire format so it can be used in another thread/context |
Packet |
fromBytes(byte[] bytes)
Reads the packet from the given byte[] |
Packet |
fromBytes(byte[] bytes,
int offset,
int length)
Reads the packet from the given byte[] |
int |
getCurrentWireFormatVersion()
|
void |
initiateProtocol(DataOutput dataOut)
Some wire formats require a handshake at start-up |
Packet |
readPacket(DataInput in)
Reads a packet from the given input stream |
Packet |
readPacket(int firstByte,
DataInput in)
A helper method for working with sockets where the first byte is read first, then the rest of the message is read. |
Packet |
readPacket(String channelID,
DatagramPacket dpacket)
Read a packet from a Datagram packet from the given channelID. |
byte[] |
toBytes(Packet packet)
A helper method which converts a packet into a byte array |
void |
writePacket(Packet packet,
DataOutput out)
Writes the packet to the given output stream |
DatagramPacket |
writePacket(String channelID,
Packet packet)
Writes the given package to a new datagram |
Method Detail |
public Packet readPacket(DataInput in) throws IOException
in
-
IOException
public Packet readPacket(int firstByte, DataInput in) throws IOException
firstByte
- the first byte of the packetin
- the rest of the packet
IOException
public Packet readPacket(String channelID, DatagramPacket dpacket) throws IOException
channelID
- is the unique channel IDdpacket
-
IOException
public void writePacket(Packet packet, DataOutput out) throws IOException, JMSException
packet
- out
-
IOException
JMSException
public DatagramPacket writePacket(String channelID, Packet packet) throws IOException, JMSException
channelID
- is the unique channel IDpacket
- is the packet to write
IOException
JMSException
public Packet fromBytes(byte[] bytes, int offset, int length) throws IOException
bytes
- offset
- length
-
IOException
public Packet fromBytes(byte[] bytes) throws IOException
bytes
-
IOException
public byte[] toBytes(Packet packet) throws IOException, JMSException
packet
-
IOException
JMSException
public WireFormat copy()
public boolean canProcessWireFormatVersion(int version)
version
- the version number to test
public int getCurrentWireFormatVersion()
public void initiateProtocol(DataOutput dataOut) throws IOException, JMSException
dataOut
-
IOException
JMSException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |