Class WebSocketChunkedInput
- java.lang.Object
-
- io.netty.handler.codec.http.websocketx.WebSocketChunkedInput
-
- All Implemented Interfaces:
ChunkedInput<WebSocketFrame>
public final class WebSocketChunkedInput extends java.lang.Object implements ChunkedInput<WebSocketFrame>
AChunkedInputthat 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,ContinuationWebSocketFramewith finalFragment will be written.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Releases the resources associated with the input.booleanisEndOfInput()Returntrueif and only if there is no data left in the stream and the stream has reached at its end.longlength()Returns the length of the input.longprogress()Returns current transfer progress.WebSocketFramereadChunk(ByteBufAllocator allocator)Fetches a chunked data from the stream.WebSocketFramereadChunk(ChannelHandlerContext ctx)Deprecated.
-
-
-
Constructor Detail
-
WebSocketChunkedInput
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input)
Creates a new instance using the specified input.- Parameters:
input-ChunkedInputcontaining data to write
-
WebSocketChunkedInput
public WebSocketChunkedInput(ChunkedInput<ByteBuf> input, int rsv)
Creates a new instance using the specified input.- Parameters:
input-ChunkedInputcontaining data to writersv- RSV1, RSV2, RSV3 used for extensions- Throws:
java.lang.NullPointerException- ifinputis null
-
-
Method Detail
-
isEndOfInput
public boolean isEndOfInput() throws java.lang.ExceptionDescription copied from interface:ChunkedInputReturntrueif and only if there is no data left in the stream and the stream has reached at its end.- Specified by:
isEndOfInputin interfaceChunkedInput<WebSocketFrame>- Returns:
trueif and only if there is no data left in the stream and the stream has reached at its end.- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.ExceptionReleases the resources associated with the input.- Specified by:
closein interfaceChunkedInput<WebSocketFrame>- Throws:
java.lang.Exception
-
readChunk
@Deprecated public WebSocketFrame readChunk(ChannelHandlerContext ctx) throws java.lang.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:
readChunkin interfaceChunkedInput<WebSocketFrame>- Parameters:
ctx-ChannelHandlerContextcontext of channelHandler- Returns:
WebSocketFramecontain chunk of data- Throws:
java.lang.Exception
-
readChunk
public WebSocketFrame readChunk(ByteBufAllocator allocator) throws java.lang.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:
readChunkin interfaceChunkedInput<WebSocketFrame>- Parameters:
allocator-ByteBufAllocator- Returns:
WebSocketFramecontain chunk of data- Throws:
java.lang.Exception
-
length
public long length()
Description copied from interface:ChunkedInputReturns the length of the input.- Specified by:
lengthin interfaceChunkedInput<WebSocketFrame>- Returns:
- the length of the input if the length of the input is known. a negative value if the length of the input is unknown.
-
progress
public long progress()
Description copied from interface:ChunkedInputReturns current transfer progress.- Specified by:
progressin interfaceChunkedInput<WebSocketFrame>
-
-