|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.activemq.io.AbstractWireFormat
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.
Field Summary | |
protected boolean |
cachingEnabled
|
protected DataInputStream |
transportDataIn
|
protected DataOutputStream |
transportDataOut
|
Fields inherited from interface org.activemq.io.WireFormat |
DEFAULT_MAXIMUM_MESSAGE_SIZE |
Constructor Summary | |
AbstractWireFormat()
|
Method Summary | |
boolean |
doesSupportMessageCompression()
Some wire formats will not be able to understand compressed messages |
boolean |
doesSupportMessageFragmentation()
some wire formats will implement their own fragementation |
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[] |
DataInputStream |
getTransportDataIn()
|
DataOutputStream |
getTransportDataOut()
|
void |
initiateClientSideProtocol()
Some wire formats require a handshake at start-up |
void |
initiateServerSideProtocol()
Some wire formats require a handshake at start-up |
boolean |
isCachingEnabled()
|
Packet |
readPacket(DataInput dataIn)
Reads a packet from the given input stream |
Packet |
readPacket(String channelID,
DatagramPacket dpacket)
Read a packet from a Datagram packet from the given channelID. |
void |
registerTransportStreams(DataOutputStream dataOut,
DataInputStream dataIn)
some transports may register their streams (e.g. |
void |
setCachingEnabled(boolean enableCaching)
|
void |
setTransportDataIn(DataInputStream transportDataIn)
|
void |
setTransportDataOut(DataOutputStream transportDataOut)
|
byte[] |
toBytes(Packet packet)
A helper method which converts a packet into a byte array |
DatagramPacket |
writePacket(String channelID,
Packet packet)
Writes the given package to a new datagram |
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.WireFormat |
canProcessWireFormatVersion, copy, getCurrentWireFormatVersion, readPacket, writePacket |
Field Detail |
protected DataOutputStream transportDataOut
protected DataInputStream transportDataIn
protected boolean cachingEnabled
Constructor Detail |
public AbstractWireFormat()
Method Detail |
public Packet readPacket(String channelID, DatagramPacket dpacket) throws IOException
readPacket
in interface WireFormat
channelID
- is the unique channel IDdpacket
-
IOException
public DatagramPacket writePacket(String channelID, Packet packet) throws IOException, JMSException
writePacket
in interface WireFormat
channelID
- is the unique channel IDpacket
- is the packet to write
JMSException
IOException
public Packet fromBytes(byte[] bytes, int offset, int length) throws IOException
fromBytes
in interface WireFormat
bytes
- offset
- length
-
IOException
public Packet fromBytes(byte[] bytes) throws IOException
fromBytes
in interface WireFormat
bytes
-
IOException
public byte[] toBytes(Packet packet) throws IOException, JMSException
toBytes
in interface WireFormat
packet
-
IOException
JMSException
public void registerTransportStreams(DataOutputStream dataOut, DataInputStream dataIn)
registerTransportStreams
in interface WireFormat
dataOut
- dataIn
- public void initiateClientSideProtocol() throws IOException
initiateClientSideProtocol
in interface WireFormat
IOException
public void initiateServerSideProtocol() throws IOException
initiateServerSideProtocol
in interface WireFormat
IOException
public boolean isCachingEnabled()
isCachingEnabled
in interface WireFormat
public void setCachingEnabled(boolean enableCaching)
setCachingEnabled
in interface WireFormat
enableCaching
- The enableCaching to set.public boolean doesSupportMessageFragmentation()
doesSupportMessageFragmentation
in interface WireFormat
public boolean doesSupportMessageCompression()
doesSupportMessageCompression
in interface WireFormat
public DataOutputStream getTransportDataOut()
public void setTransportDataOut(DataOutputStream transportDataOut)
transportDataOut
- The transportDataOut to set.public DataInputStream getTransportDataIn()
public void setTransportDataIn(DataInputStream transportDataIn)
transportDataIn
- The transportDataIn to set.public Packet readPacket(DataInput dataIn) throws IOException
WireFormat
readPacket
in interface WireFormat
dataIn
-
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |