|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.socket.SocketBuffer
public class SocketBuffer
Holds 1 serialized message for receiving or sending. Has a growable buffer. Has specialized code for RouteMessage, Liveness Message, and byte arrays. This code is ugly and does too many things. However right now this is what we have. There are Several Different Constructors. Depending which one you use, different other methods will work. Look at the docs on the individual constructors for more info.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The initial buffer size (it is growable) |
Constructor Summary | |
---|---|
SocketBuffer(byte[] output)
Just bytes (no real concept of a message.) This is for a) sourcerouting bytes b) for a usually a stream header for getResponse(). |
|
SocketBuffer(byte[] input,
SocketPastryNode spn)
When you expect to read a message. |
|
SocketBuffer(EpochInetSocketAddress address,
SourceRoute path,
PRawMessage msg)
This serializes UDP messages with the appropriate source route header. |
|
SocketBuffer(MessageDeserializer defaultDeserializer,
NodeHandleFactory nhf)
Main Constructor for writing an object. |
|
SocketBuffer(PRawMessage rm)
Serializes a SourceRoute (don't know why this isn't done in the stream header serializer. |
|
SocketBuffer(SourceRoute path,
int appId)
Used to initialize a TCP stream header. |
Method Summary | |
---|---|
Message |
deserialize(MessageDeserializer md)
|
int |
getAddress()
|
java.nio.ByteBuffer |
getBuffer()
|
byte[] |
getBytes()
|
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 |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public SocketBuffer(MessageDeserializer defaultDeserializer, NodeHandleFactory nhf)
defaultDeserializer
- public SocketBuffer(byte[] input, SocketPastryNode spn) throws java.io.IOException
java.io.IOException
public SocketBuffer(EpochInetSocketAddress address, SourceRoute path, PRawMessage msg) throws java.io.IOException
address
- the local addresspath
- the path to the destinationmsg
- the message
java.io.IOException
public SocketBuffer(SourceRoute path, int appId) throws java.io.IOException
path
- appId
-
java.io.IOException
public SocketBuffer(byte[] output)
output
- public SocketBuffer(PRawMessage rm) throws java.io.IOException
rm
- logger
-
java.io.IOException
Method Detail |
---|
protected void initialize(int size)
public boolean isRouteMessage()
public SendOptions getOptions()
public RouteMessage getRouteMessage()
public void serialize(PRawMessage msg, boolean reset) throws java.io.IOException
msg
-
java.io.IOException
public java.nio.ByteBuffer getBuffer()
public byte[] getBytes()
public int getAddress()
getAddress
in interface RawMessageDelivery
public Message deserialize(MessageDeserializer md) throws java.io.IOException
deserialize
in interface RawMessageDelivery
java.io.IOException
public short getInnermostType()
public int getInnermostAddress()
public short getType()
public void setType(short type)
public java.lang.String toString()
toString
in class java.lang.Object
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |