com.sun.grizzly.comet
Class CometReader

java.lang.Object
  extended by com.sun.grizzly.comet.CometReader
Direct Known Subclasses:
CometReader

public class CometReader
extends Object

Non blocking IO reader. This class can be used from a CometHandler to execute non blocking read. This is usefull when the client is pipelining data. The CometHandler will be notified as soon as bytes are arriving. CometHandler who wants to be notified just need to register themself by calling CometContext.registerAsyncRead()

Author:
Jeanfrancois Arcand

Constructor Summary
CometReader()
           
 
Method Summary
 boolean isReady()
          Return true if this instance is ready to read.
 int read(byte[] buf)
          Read bytes without blocking.
 int read(byte[] buf, int off, int len)
          Read bytes without blocking.
 void recycle()
          Recycle this object.
protected  void setChannel(SocketChannel socketChannel)
          Set the underlying SocketChannel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CometReader

public CometReader()
Method Detail

setChannel

protected void setChannel(SocketChannel socketChannel)
Set the underlying SocketChannel.


read

public int read(byte[] buf)
         throws IOException
Read bytes without blocking.

Throws:
IOException

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException
Read bytes without blocking.

Throws:
IOException

recycle

public void recycle()
Recycle this object.


isReady

public boolean isReady()
Return true if this instance is ready to read.



Copyright © 2012 Oracle Corporation. All Rights Reserved.