Class WebSocketChunkedInput
- java.lang.Object
-
- io.netty.handler.codec.http.websocketx.WebSocketChunkedInput
-
- All Implemented Interfaces:
io.netty.handler.stream.ChunkedInput<WebSocketFrame>
public final class WebSocketChunkedInput extends Object implements io.netty.handler.stream.ChunkedInput<WebSocketFrame>
AChunkedInput
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 Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
WebSocketChunkedInput
public WebSocketChunkedInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input)
Creates a new instance using the specified input.- Parameters:
input
-ChunkedInput
containing data to write
-
WebSocketChunkedInput
public WebSocketChunkedInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input, int rsv)
Creates a new instance using the specified input.- Parameters:
input
-ChunkedInput
containing data to writersv
- RSV1, RSV2, RSV3 used for extensions- Throws:
NullPointerException
- ifinput
is null
-
-
Method Detail
-
isEndOfInput
public boolean isEndOfInput() throws Exception
- Specified by:
isEndOfInput
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
- Returns:
true
if and only if there is no data left in the stream and the stream has reached at its end.- Throws:
Exception
-
close
public void close() throws Exception
Releases the resources associated with the input.- Specified by:
close
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
- Throws:
Exception
-
readChunk
@Deprecated public WebSocketFrame readChunk(io.netty.channel.ChannelHandlerContext ctx) throws Exception
Deprecated.UsereadChunk(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 subsequentisEndOfInput()
call must returntrue
.- Specified by:
readChunk
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
- Parameters:
ctx
-ChannelHandlerContext
context of channelHandler- Returns:
WebSocketFrame
contain chunk of data- Throws:
Exception
-
readChunk
public WebSocketFrame readChunk(io.netty.buffer.ByteBufAllocator allocator) throws Exception
Fetches a chunked data from the stream. Once this method returns the last chunk and thus the stream has reached at its end, any subsequentisEndOfInput()
call must returntrue
.- Specified by:
readChunk
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
- Parameters:
allocator
-ByteBufAllocator
- Returns:
WebSocketFrame
contain chunk of data- Throws:
Exception
-
length
public long length()
- Specified by:
length
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
-
progress
public long progress()
- Specified by:
progress
in interfaceio.netty.handler.stream.ChunkedInput<WebSocketFrame>
-
-