org.restlet.engine.http.io
Class ReadableEntityChannel

java.lang.Object
  extended by java.nio.channels.spi.AbstractInterruptibleChannel
      extended by java.nio.channels.SelectableChannel
          extended by org.restlet.engine.http.io.ReadableEntityChannel
All Implemented Interfaces:
Closeable, Channel, InterruptibleChannel, ReadableByteChannel

public class ReadableEntityChannel
extends SelectableChannel
implements ReadableByteChannel

Readable byte channel based on a source socket channel that must only be partially read.


Constructor Summary
ReadableEntityChannel(ByteBuffer remainingBuffer, SelectableChannel source, long availableSize)
          Constructor.
 
Method Summary
 Object blockingLock()
           
 SelectableChannel configureBlocking(boolean block)
           
protected  void implCloseChannel()
           
 boolean isBlocking()
           
 boolean isRegistered()
           
 SelectionKey keyFor(Selector sel)
           
 SelectorProvider provider()
           
 int read(ByteBuffer dst)
          Reads some bytes and put them into the destination buffer.
 SelectionKey register(Selector sel, int ops, Object att)
           
 int validOps()
           
 
Methods inherited from class java.nio.channels.SelectableChannel
register
 
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

ReadableEntityChannel

public ReadableEntityChannel(ByteBuffer remainingBuffer,
                             SelectableChannel source,
                             long availableSize)
Constructor.

Parameters:
remainingBuffer - The byte buffer remaining from previous read processing.
source - The source channel.
availableSize - The available size that can be read from the source channel.
Method Detail

blockingLock

public Object blockingLock()
Specified by:
blockingLock in class SelectableChannel

configureBlocking

public SelectableChannel configureBlocking(boolean block)
                                    throws IOException
Specified by:
configureBlocking in class SelectableChannel
Throws:
IOException

implCloseChannel

protected void implCloseChannel()
                         throws IOException
Specified by:
implCloseChannel in class AbstractInterruptibleChannel
Throws:
IOException

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in class SelectableChannel

isRegistered

public boolean isRegistered()
Specified by:
isRegistered in class SelectableChannel

keyFor

public SelectionKey keyFor(Selector sel)
Specified by:
keyFor in class SelectableChannel

provider

public SelectorProvider provider()
Specified by:
provider in class SelectableChannel

read

public int read(ByteBuffer dst)
         throws IOException
Reads some bytes and put them into the destination buffer. The bytes come from the underlying channel.

Specified by:
read in interface ReadableByteChannel
Parameters:
dst - The destination buffer.
Returns:
The number of bytes read, or -1 if the end of the channel has been reached.
Throws:
IOException

register

public SelectionKey register(Selector sel,
                             int ops,
                             Object att)
                      throws ClosedChannelException
Specified by:
register in class SelectableChannel
Throws:
ClosedChannelException

validOps

public int validOps()
Specified by:
validOps in class SelectableChannel


Copyright © 2005-2011 Noelios Technologies.