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.

Version:
  $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $
Author:
  Jeff Hoye

Field Summary
`static int` | `DEFAULT_BUFFER_SIZE` DESCRIBE THE FIELD
`static byte[]` | `ZERO` DESCRIBE THE FIELD

Constructor Summary
`SocketBuffer(byte[] output)` Constructor for SocketBuffer.
`SocketBuffer(byte[] input, SocketPastryNode spn)` Constructor for SocketBuffer.
`SocketBuffer(EpochInetSocketAddress address, SourceRoute path)` For a quick write.
`SocketBuffer(EpochInetSocketAddress address, SourceRoute path, PRawMessage msg)` Constructor for SocketBuffer.
`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)` DESCRIBE THE METHOD
`int` | `getAddress()` Gets the Address attribute of the SocketBuffer object
`java.nio.ByteBuffer` | `getBuffer()` Gets the Buffer attribute of the SocketBuffer object
`int` | `getInnermostAddress()` Gets the InnermostAddress attribute of the SocketBuffer object
`short` | `getInnermostType()` Gets the InnermostType attribute of the SocketBuffer object
`SendOptions` | `getOptions()` Gets the Options attribute of the SocketBuffer object
`RouteMessage` | `getRouteMessage()` Gets the RouteMessage attribute of the SocketBuffer object
`short` | `getType()` Gets the Type attribute of the SocketBuffer object
`protected void` | `initialize(int size)` DESCRIBE THE METHOD
`boolean` | `isRouteMessage()` Gets the RouteMessage attribute of the SocketBuffer object
`void` | `serialize(PRawMessage msg, boolean reset)` Will grow the buffer as needed
`void` | `setType(short type)` Sets the Type attribute of the SocketBuffer object
`java.lang.String` | `toString()` Converts to a String representation of the object.

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

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

### ZERO

    public static final byte[] ZERO

  DESCRIBE THE FIELD

Constructor Detail

### SocketBuffer

    public SocketBuffer(byte[] output)

  Constructor for SocketBuffer.

  Parameters:
    `output` - DESCRIBE THE PARAMETER

### SocketBuffer

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

  Constructor for SocketBuffer.

  Parameters:
    `input` - DESCRIBE THE PARAMETER
    `spn` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### SocketBuffer

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

  For quick write

  Parameters:
    `rm` -
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### SocketBuffer

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

  For a quick write.

  Parameters:
    `address` - DESCRIBE THE PARAMETER
    `path` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException`

### SocketBuffer

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

  Constructor for SocketBuffer.

  Parameters:
    `address` - DESCRIBE THE PARAMETER
    `path` - DESCRIBE THE PARAMETER
    `msg` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### 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` -
    `nhf` - DESCRIBE THE PARAMETER

Method Detail

### isRouteMessage

    public boolean isRouteMessage()

  Gets the RouteMessage attribute of the SocketBuffer object

  Returns:
    The RouteMessage value

### getOptions

    public SendOptions getOptions()

  Gets the Options attribute of the SocketBuffer object

  Returns:
    The Options value

### getRouteMessage

    public RouteMessage getRouteMessage()

  Gets the RouteMessage attribute of the SocketBuffer object

  Returns:
    The RouteMessage value

### getBuffer

    public java.nio.ByteBuffer getBuffer()

  Gets the Buffer attribute of the SocketBuffer object

  Returns:
    The Buffer value

### getAddress

    public int getAddress()

  Gets the Address attribute of the SocketBuffer object

  Specified by:
    `getAddress` in interface `RawMessageDelivery`
  Returns:
    The Address value

### getInnermostType

    public short getInnermostType()

  Gets the InnermostType attribute of the SocketBuffer object

  Returns:
    The InnermostType value

### getInnermostAddress

    public int getInnermostAddress()

  Gets the InnermostAddress attribute of the SocketBuffer object

  Returns:
    The InnermostAddress value

### getType

    public short getType()

  Gets the Type attribute of the SocketBuffer object

  Returns:
    The Type value

### setType

    public void setType(short type)

  Sets the Type attribute of the SocketBuffer object

  Parameters:
    `type` - The new Type value

### initialize

    protected void initialize(int size)

  DESCRIBE THE METHOD

  Parameters:
    `size` - DESCRIBE THE PARAMETER

### serialize

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

  Will grow the buffer as needed

  Parameters:
    `msg` -
    `reset` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### deserialize

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

  DESCRIBE THE METHOD

  Specified by:
    `deserialize` in interface `RawMessageDelivery`
  Parameters:
    `md` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### toString

    public java.lang.String toString()

  Converts to a String representation of the object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A string representation of the 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.