pyrasun.eio
Class EIOOutputBuffer

java.lang.Object
  extended bypyrasun.eio.EIOOutputBuffer

public class EIOOutputBuffer
extends java.lang.Object

Abstracts out NIO writing and related buffer operations to make life slightly easier for for normal folk. You normally get one of these by calling ReadWriteEndpoint.getOutputBuffer(). If you want to instantiate one yourself you're freakin' crazy (but I won't stop you).


Constructor Summary
EIOOutputBuffer(ReadWriteEndpoint endpoint)
          create an output buffer that's associated with the specified Endpoint.
 
Method Summary
 ByteBufferOutputStream getOutputStream()
          Returns the associated ByteBufferOutputStream.
 boolean isWriteInProgress()
          Returns true if a write is in progress or only a partial write was performed, false otherwise.
 void reset()
          Reset everything back to initial state, including the associated ByteBufferOutputStream and the backing output ByteBuffer.
 boolean writeResults()
          Write stuff from underlying ByteBuffer out to the channel (this includes anything you may have written via the stream returned by getOutputStream()).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EIOOutputBuffer

public EIOOutputBuffer(ReadWriteEndpoint endpoint)
create an output buffer that's associated with the specified Endpoint.

Method Detail

reset

public void reset()
Reset everything back to initial state, including the associated ByteBufferOutputStream and the backing output ByteBuffer.


getOutputStream

public ByteBufferOutputStream getOutputStream()
Returns the associated ByteBufferOutputStream.


writeResults

public boolean writeResults()
                     throws java.io.IOException
Write stuff from underlying ByteBuffer out to the channel (this includes anything you may have written via the stream returned by getOutputStream()). Returns true if we wrote it all, false if there's bits still lying about. This method also automatically updates the associated Endpoint to indicate whether the write completed or was only partially completed (so you don't have to!).

Throws:
java.io.IOException

isWriteInProgress

public boolean isWriteInProgress()
Returns true if a write is in progress or only a partial write was performed, false otherwise.



Pyrasun EmberIO