org.codehaus.activemq.transport.xstream
Class XStreamWireFormat

java.lang.Object
  extended byorg.codehaus.activemq.message.WireFormat
      extended byorg.codehaus.activemq.message.TextWireFormat
          extended byorg.codehaus.activemq.transport.xstream.XStreamWireFormat

public class XStreamWireFormat
extends TextWireFormat

A WireFormat implementation which uses the

Constructor Summary
XStreamWireFormat()
           
 
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
protected  com.thoughtworks.xstream.XStream createXStream()
           
 Packet fromString(String xml)
          Converts the String into a Packet
 int getCurrentWireFormatVersion()
           
 com.thoughtworks.xstream.XStream getXStream()
           
 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.
 void setXStream(com.thoughtworks.xstream.XStream xStream)
           
 String toString(Packet packet)
          Converts the packet into a String
 void writePacket(Packet packet, DataOutput out)
          Writes the packet to the given output stream
 
Methods inherited from class org.codehaus.activemq.message.WireFormat
fromBytes, fromBytes, readPacket, toBytes, writePacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XStreamWireFormat

public XStreamWireFormat()
Method Detail

readPacket

public Packet readPacket(DataInput in)
                  throws IOException
Description copied from class: WireFormat
Reads a packet from the given input stream

Specified by:
readPacket in class WireFormat
Parameters:
in -
Returns:
Throws:
IOException

readPacket

public Packet readPacket(int firstByte,
                         DataInput in)
                  throws IOException
Description copied from class: WireFormat
A helper method for working with sockets where the first byte is read first, then the rest of the message is read.

Its common when dealing with sockets to have different timeout semantics until the first non-zero byte is read of a message, after which time a zero timeout is used.

Specified by:
readPacket in class WireFormat
Parameters:
firstByte - the first byte of the packet
in - the rest of the packet
Returns:
Throws:
IOException

writePacket

public void writePacket(Packet packet,
                        DataOutput out)
                 throws IOException,
                        JMSException
Description copied from class: WireFormat
Writes the packet to the given output stream

Specified by:
writePacket in class WireFormat
Parameters:
packet -
out -
Throws:
IOException
JMSException

copy

public WireFormat copy()
Description copied from class: WireFormat
Creates a new copy of this wire format so it can be used in another thread/context

Specified by:
copy in class WireFormat
Returns:

toString

public String toString(Packet packet)
Description copied from class: TextWireFormat
Converts the packet into a String

Specified by:
toString in class TextWireFormat

fromString

public Packet fromString(String xml)
Description copied from class: TextWireFormat
Converts the String into a Packet

Specified by:
fromString in class TextWireFormat

canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Specified by:
canProcessWireFormatVersion in class WireFormat
Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Specified by:
getCurrentWireFormatVersion in class WireFormat
Returns:
the current version of this wire format

getXStream

public com.thoughtworks.xstream.XStream getXStream()

setXStream

public void setXStream(com.thoughtworks.xstream.XStream xStream)

createXStream

protected com.thoughtworks.xstream.XStream createXStream()


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