public final class WebSocketChunkedInput extends Object implements ChunkedInput<WebSocketFrame>
ChunkedInput
that fetches data chunk by chunk for use with WebSocket chunked transfers.
Each chunk from the input data will be wrapped within a ContinuationWebSocketFrame
.
At the end of the input data, ContinuationWebSocketFrame
with finalFragment will be written.
Constructor and Description |
---|
WebSocketChunkedInput(ChunkedInput<ByteBuf> input)
Creates a new instance using the specified input.
|
WebSocketChunkedInput(ChunkedInput<ByteBuf> input,
int rsv)
Creates a new instance using the specified input.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases the resources associated with the input.
|
boolean |
isEndOfInput()
Return
true if and only if there is no data left in the stream
and the stream has reached at its end. |
WebSocketFrame |
readChunk(ChannelHandlerContext ctx)
Fetches a chunked data from the stream.
|
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input)
input
- ChunkedInput
containing data to writepublic WebSocketChunkedInput(ChunkedInput<ByteBuf> input, int rsv)
input
- ChunkedInput
containing data to writersv
- RSV1, RSV2, RSV3 used for extensionsNullPointerException
- if input
is nullpublic boolean isEndOfInput() throws Exception
ChunkedInput
true
if and only if there is no data left in the stream
and the stream has reached at its end.isEndOfInput
in interface ChunkedInput<WebSocketFrame>
true
if and only if there is no data left in the stream
and the stream has reached at its end.Exception
public void close() throws Exception
close
in interface ChunkedInput<WebSocketFrame>
Exception
public WebSocketFrame readChunk(ChannelHandlerContext ctx) throws Exception
isEndOfInput()
call must return true
.readChunk
in interface ChunkedInput<WebSocketFrame>
ctx
- ChannelHandlerContext
context of channelHandlerWebSocketFrame
contain chunk of dataException
Copyright © 2008-2016 The Netty Project. All Rights Reserved.