Rice Pastry API

rice.p2p.commonapi.appsocket
Interface AppSocket


public interface AppSocket

Interface for sending bulk data from the application. Mimics java's non-blocking SocketChannel interface this should make it easier to implement in any Java-based p2p overlay.

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

Method Summary
 void close()
          Closes this socket.
 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 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.
 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.
 

Method Detail

read

public long read(java.nio.ByteBuffer[] dsts,
                 int offset,
                 int length)
          throws java.io.IOException
Reads a sequence of bytes from this channel into a subsequence of the given buffers.

Parameters:
dsts - DESCRIBE THE PARAMETER
offset - DESCRIBE THE PARAMETER
length - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

write

public long write(java.nio.ByteBuffer[] srcs,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a sequence of bytes to this channel from a subsequence of the given buffers.

Parameters:
srcs - DESCRIBE THE PARAMETER
offset - DESCRIBE THE PARAMETER
length - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE
Throws:
java.io.IOException

register

public void register(boolean wantToRead,
                     boolean wantToWrite,
                     int timeout,
                     AppSocketReceiver receiver)
Must be called every time a Read/Write occurs to continue operation.

Parameters:
wantToRead - DESCRIBE THE PARAMETER
wantToWrite - DESCRIBE THE PARAMETER
timeout - DESCRIBE THE PARAMETER
receiver - DESCRIBE THE PARAMETER

shutdownOutput

public void shutdownOutput()
Disables the output stream for this socket. Used to properly close down a socket used for bi-directional communication that can be initated by either side.


close

public void close()
Closes this socket.


Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection