public final class WebSocketChunkedInput extends java.lang.Object implements ChunkedInput<WebSocketFrame>
ChunkedInput ,通过块获取数据块以用于WebSocket分块传输。
来自输入数据的每个块将被包装在ContinuationWebSocketFrame内 。 在输入数据的末尾 ,将会写入带有finalFragment的ContinuationWebSocketFrame。
| Constructor and Description |
|---|
WebSocketChunkedInput(ChunkedInput<ByteBuf> input)
使用指定的输入创建一个新实例。
|
WebSocketChunkedInput(ChunkedInput<ByteBuf> input, int rsv)
使用指定的输入创建一个新实例。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
释放与输入相关的资源。
|
boolean |
isEndOfInput()
返回
true当且仅当数据流中没有剩余数据且数据流已达到其结尾时。
|
long |
length()
返回输入的长度。
|
long |
progress()
返回当前传输进度。
|
WebSocketFrame |
readChunk(ByteBufAllocator allocator)
从流中获取分块的数据。
|
WebSocketFrame |
readChunk(ChannelHandlerContext ctx)
已过时。
|
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input)
input - ChunkedInput包含要写入的数据
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input, int rsv)
input - ChunkedInput包含要写入的数据
rsv - 用于扩展的RSV1,RSV2,RSV3
java.lang.NullPointerException - 如果
input为空
public boolean isEndOfInput()
throws java.lang.Exception
ChunkedInput
true当且仅当数据流中没有剩余数据且数据流已达到其结尾时。
isEndOfInput接口
ChunkedInput<WebSocketFrame>
true当且仅当数据流中没有剩余数据且数据流已达到数据结束时。
java.lang.Exception
public void close()
throws java.lang.Exception
close接口
ChunkedInput<WebSocketFrame>
java.lang.Exception
@Deprecated public WebSocketFrame readChunk(ChannelHandlerContext ctx) throws java.lang.Exception
readChunk(ByteBufAllocator) 。
从流中获取分块的数据。
一旦此方法返回最后一个块并因此流到达末尾,任何后续的isEndOfInput()调用都必须返回true 。
readChunk在界面
ChunkedInput<WebSocketFrame>
ctx - ChannelHandlerContext channelHandler的上下文
WebSocketFrame包含大量的数据
java.lang.Exception
public WebSocketFrame readChunk(ByteBufAllocator allocator) throws java.lang.Exception
isEndOfInput()调用都必须返回true 。
readChunk在界面
ChunkedInput<WebSocketFrame>
allocator - ByteBufAllocator
WebSocketFrame包含大量的数据
java.lang.Exception
public long length()
ChunkedInput
length接口
ChunkedInput<WebSocketFrame>
public long progress()
ChunkedInput
progress在界面
ChunkedInput<WebSocketFrame>
Copyright © 2008–2018 The Netty Project. All rights reserved.