Rice Pastry API

org.mpisws.p2p.transport.util
Class BufferWriter<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.util.BufferWriter<Identifier>
Type Parameters:
Identifier -
All Implemented Interfaces:
P2PSocketReceiver<Identifier>

public class BufferWriter<Identifier>
extends java.lang.Object
implements P2PSocketReceiver<Identifier>

Writes a ByteBuffer to the socket then calls receiveResult(). Used for writing headers. If continuation is null, then it closes the socket when done, or if there is an error.

Author:
Jeff Hoye

Constructor Summary
BufferWriter(java.nio.ByteBuffer writeMe, P2PSocket<Identifier> socket, Continuation<P2PSocket<Identifier>,java.lang.Exception> continuation)
           
BufferWriter(java.nio.ByteBuffer writeMe, P2PSocket<Identifier> socket, Continuation<P2PSocket<Identifier>,java.lang.Exception> continuation, boolean includeSizeHeader)
           
 
Method Summary
 void receiveException(P2PSocket<Identifier> socket, java.lang.Exception ioe)
          Called when there is an error
 void receiveSelectResult(P2PSocket<Identifier> socket, boolean canRead, boolean canWrite)
          Called when a socket is available for read/write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferWriter

public BufferWriter(java.nio.ByteBuffer writeMe,
                    P2PSocket<Identifier> socket,
                    Continuation<P2PSocket<Identifier>,java.lang.Exception> continuation,
                    boolean includeSizeHeader)
Parameters:
writeMe -
socket -
continuation -
includeSizeHeader - true if the size needs to be written in a header, false if it is a fixed size buffer

BufferWriter

public BufferWriter(java.nio.ByteBuffer writeMe,
                    P2PSocket<Identifier> socket,
                    Continuation<P2PSocket<Identifier>,java.lang.Exception> continuation)
Method Detail

receiveException

public void receiveException(P2PSocket<Identifier> socket,
                             java.lang.Exception ioe)
Description copied from interface: P2PSocketReceiver
Called when there is an error

Specified by:
receiveException in interface P2PSocketReceiver<Identifier>

receiveSelectResult

public void receiveSelectResult(P2PSocket<Identifier> socket,
                                boolean canRead,
                                boolean canWrite)
                         throws java.io.IOException
Description copied from interface: P2PSocketReceiver
Called when a socket is available for read/write

Specified by:
receiveSelectResult in interface P2PSocketReceiver<Identifier>
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection