public final class WebSocketChunkedInput extends Object implements io.netty.handler.stream.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(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input)
Creates a new instance using the specified input.
|
WebSocketChunkedInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.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() |
long |
length() |
long |
progress() |
WebSocketFrame |
readChunk(io.netty.buffer.ByteBufAllocator allocator)
Fetches a chunked data from the stream.
|
WebSocketFrame |
readChunk(io.netty.channel.ChannelHandlerContext ctx)
Deprecated.
Use
readChunk(ByteBufAllocator) .
Fetches a chunked data from the stream. Once this method returns the last chunk
and thus the stream has reached at its end, any subsequent isEndOfInput()
call must return true . |
public WebSocketChunkedInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input)
input
- ChunkedInput
containing data to writepublic WebSocketChunkedInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input, int rsv)
input
- ChunkedInput
containing data to writersv
- RSV1, RSV2, RSV3 used for extensionsNullPointerException
- if input
is nullpublic boolean isEndOfInput() throws Exception
isEndOfInput
in interface io.netty.handler.stream.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 io.netty.handler.stream.ChunkedInput<WebSocketFrame>
Exception
@Deprecated public WebSocketFrame readChunk(io.netty.channel.ChannelHandlerContext ctx) throws Exception
readChunk(ByteBufAllocator)
.
Fetches a chunked data from the stream. Once this method returns the last chunk
and thus the stream has reached at its end, any subsequent isEndOfInput()
call must return true
.readChunk
in interface io.netty.handler.stream.ChunkedInput<WebSocketFrame>
ctx
- ChannelHandlerContext
context of channelHandlerWebSocketFrame
contain chunk of dataException
public WebSocketFrame readChunk(io.netty.buffer.ByteBufAllocator allocator) throws Exception
isEndOfInput()
call must return true
.readChunk
in interface io.netty.handler.stream.ChunkedInput<WebSocketFrame>
allocator
- ByteBufAllocator
WebSocketFrame
contain chunk of dataException
public long length()
length
in interface io.netty.handler.stream.ChunkedInput<WebSocketFrame>
public long progress()
progress
in interface io.netty.handler.stream.ChunkedInput<WebSocketFrame>
Copyright © 2008–2023 The Netty Project. All rights reserved.