Class ChunkDecoder
java.lang.Object
org.apache.hc.core5.http.impl.nio.AbstractContentDecoder
org.apache.hc.core5.http.impl.nio.ChunkDecoder
- All Implemented Interfaces:
ContentDecoder
Implements chunked transfer decoding. The content is received in small chunks.
Entities transferred using this encoder can be of unlimited length.
- Since:
- 4.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private boolean
private boolean
private final Http1Config
private CharArrayBuffer
private long
private ChunkDecoder.State
private final List
<CharArrayBuffer> Fields inherited from class org.apache.hc.core5.http.impl.nio.AbstractContentDecoder
buffer, channel, completed, metrics
-
Constructor Summary
ConstructorsConstructorDescriptionChunkDecoder
(ReadableByteChannel channel, SessionInputBuffer buffer, Http1Config http1Config, BasicHttpTransportMetrics metrics) ChunkDecoder
(ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionReturns content trailers if availableprivate void
private void
int
read
(ByteBuffer dst) Reads a portion of content from the underlying channelprivate void
toString()
Methods inherited from class org.apache.hc.core5.http.impl.nio.AbstractContentDecoder
buffer, channel, fillBufferFromChannel, isCompleted, metrics, readFromChannel, readFromChannel, setCompleted, setCompleted
-
Field Details
-
state
-
endOfChunk
private boolean endOfChunk -
endOfStream
private boolean endOfStream -
lineBuf
-
chunkSize
private long chunkSize -
pos
private long pos -
http1Config
-
trailerBufs
-
trailers
-
-
Constructor Details
-
ChunkDecoder
public ChunkDecoder(ReadableByteChannel channel, SessionInputBuffer buffer, Http1Config http1Config, BasicHttpTransportMetrics metrics) - Since:
- 4.4
-
ChunkDecoder
public ChunkDecoder(ReadableByteChannel channel, SessionInputBuffer buffer, BasicHttpTransportMetrics metrics)
-
-
Method Details
-
readChunkHead
- Throws:
IOException
-
parseHeader
- Throws:
IOException
-
read
Description copied from interface:ContentDecoder
Reads a portion of content from the underlying channel- Parameters:
dst
- The buffer into which entity content is to be transferred- Returns:
- The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
- Throws:
IOException
- if I/O error occurs while reading content
-
getTrailers
Description copied from interface:ContentDecoder
Returns content trailers if available- Specified by:
getTrailers
in interfaceContentDecoder
- Overrides:
getTrailers
in classAbstractContentDecoder
- Returns:
- list of trailers
-
toString
-