Rice Pastry API

rice.pastry.socket
Class SocketBuffer

java.lang.Object
  extended byrice.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)
          Constructor for SocketBuffer.
 
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
 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()
          DESCRIBE THE METHOD
 
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 - DESCRIBE THE EXCEPTION
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
Constructor for SocketBuffer.

Parameters:
path - DESCRIBE THE PARAMETER
appId - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

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

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()
DESCRIBE THE METHOD

Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection