com.noelios.restlet.http
Class ReadableEntityChannel

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

public class ReadableEntityChannel
extends java.nio.channels.SelectableChannel
implements java.nio.channels.ReadableByteChannel

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


Constructor Summary
ReadableEntityChannel(java.nio.ByteBuffer remainingBuffer, java.nio.channels.SelectableChannel source, long availableSize)
          Constructor.
 
Method Summary
 java.lang.Object blockingLock()
           
 java.nio.channels.SelectableChannel configureBlocking(boolean block)
           
protected  void implCloseChannel()
           
 boolean isBlocking()
           
 boolean isRegistered()
           
 java.nio.channels.SelectionKey keyFor(java.nio.channels.Selector sel)
           
 java.nio.channels.spi.SelectorProvider provider()
           
 int read(java.nio.ByteBuffer dst)
          Reads some bytes and put them into the destination buffer.
 java.nio.channels.SelectionKey register(java.nio.channels.Selector sel, int ops, java.lang.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(java.nio.ByteBuffer remainingBuffer,
                             java.nio.channels.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 java.lang.Object blockingLock()
Specified by:
blockingLock in class java.nio.channels.SelectableChannel

configureBlocking

public java.nio.channels.SelectableChannel configureBlocking(boolean block)
                                                      throws java.io.IOException
Specified by:
configureBlocking in class java.nio.channels.SelectableChannel
Throws:
java.io.IOException

implCloseChannel

protected void implCloseChannel()
                         throws java.io.IOException
Specified by:
implCloseChannel in class java.nio.channels.spi.AbstractInterruptibleChannel
Throws:
java.io.IOException

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in class java.nio.channels.SelectableChannel

isRegistered

public boolean isRegistered()
Specified by:
isRegistered in class java.nio.channels.SelectableChannel

keyFor

public java.nio.channels.SelectionKey keyFor(java.nio.channels.Selector sel)
Specified by:
keyFor in class java.nio.channels.SelectableChannel

provider

public java.nio.channels.spi.SelectorProvider provider()
Specified by:
provider in class java.nio.channels.SelectableChannel

read

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

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

register

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

validOps

public int validOps()
Specified by:
validOps in class java.nio.channels.SelectableChannel


Copyright © 2005-2008 Noelios Technologies.