org.jboss.netty.handler.stream
类 ChunkedNioStream

java.lang.Object
  继承者 org.jboss.netty.handler.stream.ChunkedNioStream
所有已实现的接口:
ChunkedInput

public class ChunkedNioStream
extends java.lang.Object
implements ChunkedInput

从一个ReadableByteChannel一块一块的获取数据的ChunkedInput.请注意 ReadableByteChannel必须在阻塞模式下操作.并不支持非阻塞模式的


构造方法摘要
ChunkedNioStream(java.nio.channels.ReadableByteChannel in)
          创建一个从指定channel获取数据的实例.
ChunkedNioStream(java.nio.channels.ReadableByteChannel in, int chunkSize)
          创建一个从指定channel获取数据的实例.
 
方法摘要
 void close()
          释放该流的资源.
 long getTransferredBytes()
          返回传输的字节数.
 boolean hasNextChunk()
          只有当该流还有数据可读才返回 true.请注意false 并不总是意味着该流到了结尾.在一个慢流里该下一块可能出现短暂的无效.
 boolean isEndOfInput()
          只有当该流没有数据存在和该流到达结尾时返回true.
 java.lang.Object nextChunk()
          从数据流获取一个块数据.通常返回的块是一个ChannelBuffer,但你可以扩展传化存在的 ChannelBuffer为不同类型的你理解的处理器或编码器.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ChunkedNioStream

public ChunkedNioStream(java.nio.channels.ReadableByteChannel in)
创建一个从指定channel获取数据的实例.


ChunkedNioStream

public ChunkedNioStream(java.nio.channels.ReadableByteChannel in,
                        int chunkSize)
创建一个从指定channel获取数据的实例.

参数:
chunkSize - 每次调用nextChunk()时获取的字节数
方法详细信息

getTransferredBytes

public long getTransferredBytes()
返回传输的字节数.


hasNextChunk

public boolean hasNextChunk()
                     throws java.lang.Exception
从接口 ChunkedInput 复制的描述
只有当该流还有数据可读才返回 true.请注意false 并不总是意味着该流到了结尾.在一个慢流里该下一块可能出现短暂的无效.

指定者:
接口 ChunkedInput 中的 hasNextChunk
抛出:
java.lang.Exception

isEndOfInput

public boolean isEndOfInput()
                     throws java.lang.Exception
从接口 ChunkedInput 复制的描述
只有当该流没有数据存在和该流到达结尾时返回true.

指定者:
接口 ChunkedInput 中的 isEndOfInput
抛出:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
从接口 ChunkedInput 复制的描述
释放该流的资源.

指定者:
接口 ChunkedInput 中的 close
抛出:
java.lang.Exception

nextChunk

public java.lang.Object nextChunk()
                           throws java.lang.Exception
从接口 ChunkedInput 复制的描述
从数据流获取一个块数据.通常返回的块是一个ChannelBuffer,但你可以扩展传化存在的 ChannelBuffer为不同类型的你理解的处理器或编码器.

指定者:
接口 ChunkedInput 中的 nextChunk
返回:
返回获取的块,通常是一个ChannelBuffer.如果流没有数据存在,则为null. 请注意 null并不总是意味着该流到了结尾.在一个慢流里该下一块可能出现短暂的无效.
抛出:
java.lang.Exception