public class ChunkedStream extends java.lang.Object implements ChunkedInput<ByteBuf>
ChunkedInput ,按大块提取InputStream块中的数据。
请注意,将数据提供给ChunkedStream的InputStream实例必须尽可能准确地实现InputStream.available() ,而不是使用默认实现。 否则, ChunkedStream会生成许多太小的块或经常不必要的块。
| Constructor and Description |
|---|
ChunkedStream(java.io.InputStream in)
创建一个从指定流中提取数据的新实例。
|
ChunkedStream(java.io.InputStream in, int chunkSize)
创建一个从指定流中提取数据的新实例。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
释放与输入相关的资源。
|
boolean |
isEndOfInput()
返回
true当且仅当数据流中没有剩余数据且数据流已达到其结尾时。
|
long |
length()
返回输入的长度。
|
long |
progress()
返回当前传输进度。
|
ByteBuf |
readChunk(ByteBufAllocator allocator)
从流中获取分块的数据。
|
ByteBuf |
readChunk(ChannelHandlerContext ctx)
已过时。
|
long |
transferredBytes()
返回传输的字节数。
|
public ChunkedStream(java.io.InputStream in)
public ChunkedStream(java.io.InputStream in,
int chunkSize)
chunkSize - 每个
readChunk(ChannelHandlerContext)调用中要获取的字节数
public long transferredBytes()
public boolean isEndOfInput()
throws java.lang.Exception
ChunkedInput复制的描述
true当且仅当数据流中没有剩余数据并且数据流已达到其结尾时。
isEndOfInput在界面
ChunkedInput<ByteBuf>
java.lang.Exception
public void close()
throws java.lang.Exception
ChunkedInput复制的描述
close在界面
ChunkedInput<ByteBuf>
java.lang.Exception
@Deprecated public ByteBuf readChunk(ChannelHandlerContext ctx) throws java.lang.Exception
readChunk ,界面
ChunkedInput<ByteBuf>
ctx -它提供了一个上下文ByteBufAllocator如果缓冲区分配是必要的。
null如果流中没有剩余数据。
请注意, null并不一定意味着该流已达到其结尾。
在缓慢的流中,下一个块可能暂时不可用。
java.lang.Exception
public ByteBuf readChunk(ByteBufAllocator allocator) throws java.lang.Exception
ChunkedInput复制的描述
ChunkedInput.isEndOfInput()调用都必须返回true 。
readChunk接口
ChunkedInput<ByteBuf>
allocator - ByteBufAllocator如果缓冲区分配是必要的。
null如果流中没有剩余数据。
请注意, null并不一定意味着该流已达到其结尾。
在缓慢的流中,下一个块可能暂时不可用。
java.lang.Exception
public long length()
ChunkedInput复制的描述
length接口
ChunkedInput<ByteBuf>
public long progress()
ChunkedInput复制的描述
progress在界面
ChunkedInput<ByteBuf>
Copyright © 2008–2018 The Netty Project. All rights reserved.