Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.message
Class DefaultWireFormat

    java.lang.Object
      org.codehaus.activemq.message.WireFormat
          org.codehaus.activemq.message.DefaultWireFormat

All Implemented Interfaces:
  Serializable

public class DefaultWireFormat
extends WireFormat
implements Serializable

Default implementation used for Java-Java protocols. When talking to non-Java nodes we may use a different wire format.

Version:
  $Revision: 1.14 $
See Also:
  Serialized Form

Field Summary
`static int` | `WIRE_FORMAT_VERSION` Current wire format version for this implementation

Constructor Summary
`DefaultWireFormat()` Default Constructor

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
`int` | `getCurrentWireFormatVersion()`
`Packet` | `readPacket(DataInput in)` Reads a packet from the given input stream
`protected Packet` | `readPacket(DataInput dataIn, PacketReader reader)`
`Packet` | `readPacket(int firstByte, DataInput dataIn)` A helper method for working with sockets where the first byte is read first, then the rest of the message is read.
`byte[]` | `toBytes(Packet packet)` A helper method which converts a packet into a byte array Overrides the WireFormat to make use of the internal BytesOutputStream
`void` | `writePacket(Packet packet, DataOutput dataOut)` Write a Packet to a DataOutput
`protected void` | `writePacket(Packet packet, DataOutput dataOut, PacketWriter writer)`

Methods inherited from class org.codehaus.activemq.message.WireFormat
`fromBytes, fromBytes, readPacket, writePacket`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### WIRE_FORMAT_VERSION

    public static final int WIRE_FORMAT_VERSION

  Current wire format version for this implementation

  See Also:
    Constant Field Values

Constructor Detail

### DefaultWireFormat

    public DefaultWireFormat()

  Default Constructor

Method Detail

### 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:
    new WireFormat

### 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 dataIn)
                      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` -
    `dataIn` -
  Returns:
  Throws:
    `IOException`

### writePacket

    public void writePacket(Packet packet,
                            DataOutput dataOut)
                     throws IOException

  Write a Packet to a DataOutput

  Specified by:
    `writePacket` in class `WireFormat`
  Parameters:
    `packet` -
    `dataOut` -
  Throws:
    `IOException`

### toBytes

    public byte[] toBytes(Packet packet)
                   throws IOException

  A helper method which converts a packet into a byte array Overrides the WireFormat to make use of the internal BytesOutputStream

  Overrides:
    `toBytes` in class `WireFormat`
  Parameters:
    `packet` -
  Returns:
    a byte array representing the packet using some wire protocol
  Throws:
    `IOException`

### 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

### writePacket

    protected final void writePacket(Packet packet,
                                     DataOutput dataOut,
                                     PacketWriter writer)
                              throws IOException

  Throws:
    `IOException`

### readPacket

    protected final Packet readPacket(DataInput dataIn,
                                      PacketReader reader)
                               throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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