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

## rice.pastry.socket
Class SocketBuffer

    java.lang.Object
      rice.pastry.socket.SocketBuffer

All Implemented Interfaces:
  RawMessageDelivery

    public class SocketBuffer

extends java.lang.Object
implements RawMessageDelivery

Holds 1 serialized message for receiving or sending. Has specialized code for RouteMessage, Liveness Message, and byte arrays.

Author:
  Jeff Hoye

Field Summary
`static int` | `DEFAULT_BUFFER_SIZE`

Constructor Summary
`SocketBuffer(byte[] output)`
`SocketBuffer(byte[] input, SocketPastryNode spn)`
`SocketBuffer(EpochInetSocketAddress address, SourceRoute path)` For a quick write.
`SocketBuffer(EpochInetSocketAddress address, SourceRoute path, PRawMessage msg)`
`SocketBuffer(MessageDeserializer defaultDeserializer, NodeHandleFactory nhf)` Main Constructor
`SocketBuffer(PRawMessage rm)` For quick write
`SocketBuffer(SourceRoute path, int appId)` Used to initialize the sourceroute path.

Method Summary
`Message` | `deserialize(MessageDeserializer md)`
`int` | `getAddress()`
`java.nio.ByteBuffer` | `getBuffer()`
`int` | `getInnermostAddress()`
`short` | `getInnermostType()`
`SendOptions` | `getOptions()`
`RouteMessage` | `getRouteMessage()`
`short` | `getType()`
`protected void` | `initialize(int size)`
`boolean` | `isRouteMessage()`
`void` | `serialize(PRawMessage msg, boolean reset)` Will grow the buffer as needed
`void` | `setType(short type)`
`java.lang.String` | `toString()`

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

Field Detail

### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

Constructor Detail

### SocketBuffer

    public SocketBuffer(byte[] output)

### SocketBuffer

    public SocketBuffer(byte[] input,
                        SocketPastryNode spn)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### SocketBuffer

    public SocketBuffer(PRawMessage rm)
                 throws java.io.IOException

  For quick write

  Parameters:
    `rm` -
    `logger` -
  Throws:
    `java.io.IOException`

### SocketBuffer

    public SocketBuffer(EpochInetSocketAddress address,
                        SourceRoute path)
                 throws java.io.IOException

  For a quick write.

  Throws:
    `java.io.IOException`

### SocketBuffer

    public SocketBuffer(EpochInetSocketAddress address,
                        SourceRoute path,
                        PRawMessage msg)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### SocketBuffer

    public SocketBuffer(SourceRoute path,
                        int appId)
                 throws java.io.IOException

  Used to initialize the sourceroute path. Counterpart reading of the header is found in SocketChannelRepeater.read()

  Parameters:
    `path` -
    `appId` -
  Throws:
    `java.io.IOException`

### SocketBuffer

    public SocketBuffer(MessageDeserializer defaultDeserializer,
                        NodeHandleFactory nhf)

  Main Constructor

  Parameters:
    `defaultDeserializer` -

Method Detail

### initialize

    protected void initialize(int size)

### isRouteMessage

    public boolean isRouteMessage()

### getOptions

    public SendOptions getOptions()

### getRouteMessage

    public RouteMessage getRouteMessage()

### serialize

    public void serialize(PRawMessage msg,
                          boolean reset)
                   throws java.io.IOException

  Will grow the buffer as needed

  Parameters:
    `msg` -
  Throws:
    `java.io.IOException`

### getBuffer

    public java.nio.ByteBuffer getBuffer()

### getAddress

    public int getAddress()

  Specified by:
    `getAddress` in interface `RawMessageDelivery`

### deserialize

    public Message deserialize(MessageDeserializer md)
                        throws java.io.IOException

  Specified by:
    `deserialize` in interface `RawMessageDelivery`
  Throws:
    `java.io.IOException`

### getInnermostType

    public short getInnermostType()

### getInnermostAddress

    public int getInnermostAddress()

### getType

    public short getType()

### setType

    public void setType(short type)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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

Copyright © 2001-2005 - Rice Pastry.