|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.transport.SocketAdapter<Identifier>
public class SocketAdapter<Identifier>
Constructor Summary | |
---|---|
SocketAdapter(P2PSocket<Identifier> socket,
Environment env)
|
Method Summary | |
---|---|
void |
close()
Closes this socket. |
long |
read(java.nio.ByteBuffer dst)
Reads a sequence of bytes from this channel into a subsequence of the given buffers. |
long |
read(java.nio.ByteBuffer[] dsts,
int offset,
int length)
Reads a sequence of bytes from this channel into a subsequence of the given buffers. |
void |
receiveException(P2PSocket<Identifier> s,
java.lang.Exception e)
Called when there is an error |
void |
receiveSelectResult(P2PSocket<Identifier> s,
boolean canRead,
boolean canWrite)
Called when a socket is available for read/write |
void |
register(boolean wantToRead,
boolean wantToWrite,
int timeout,
AppSocketReceiver receiver)
Must be called every time a Read/Write occurs to continue operation. |
void |
shutdownOutput()
Disables the output stream for this socket. |
java.lang.String |
toString()
|
long |
write(java.nio.ByteBuffer src)
Writes a sequence of bytes to this channel from a subsequence of the given buffers. |
long |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
Writes a sequence of bytes to this channel from a subsequence of the given buffers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SocketAdapter(P2PSocket<Identifier> socket, Environment env)
Method Detail |
---|
public void close()
AppSocket
close
in interface AppSocket
public long read(java.nio.ByteBuffer[] dsts, int offset, int length) throws java.io.IOException
AppSocket
read
in interface AppSocket
java.io.IOException
public void register(boolean wantToRead, boolean wantToWrite, int timeout, AppSocketReceiver receiver)
AppSocket
register
in interface AppSocket
wantToRead
- if you want to read from this socketwantToWrite
- if you want to write to this sockettimeout
- // the socket's timeout value (this is a TCP level param)receiver
- will have receiveSelectResult() called on it
note that you must call select() each time receiveSelectResult() is called. This is so
your application can properly handle flow controlpublic void receiveException(P2PSocket<Identifier> s, java.lang.Exception e)
P2PSocketReceiver
receiveException
in interface P2PSocketReceiver<Identifier>
public void receiveSelectResult(P2PSocket<Identifier> s, boolean canRead, boolean canWrite) throws java.io.IOException
P2PSocketReceiver
receiveSelectResult
in interface P2PSocketReceiver<Identifier>
java.io.IOException
public void shutdownOutput()
AppSocket
shutdownOutput
in interface AppSocket
public long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException
AppSocket
write
in interface AppSocket
java.io.IOException
public long read(java.nio.ByteBuffer dst) throws java.io.IOException
AppSocket
read
in interface AppSocket
java.io.IOException
public long write(java.nio.ByteBuffer src) throws java.io.IOException
AppSocket
write
in interface AppSocket
java.io.IOException
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 |