Class ChunkEncoder
java.lang.Object
org.apache.hc.core5.http.impl.nio.AbstractContentEncoder
org.apache.hc.core5.http.impl.nio.ChunkEncoder
- All Implemented Interfaces:
ContentEncoder
Implements chunked transfer coding. The content is sent in small chunks.
Entities transferred using this decoder can be of unlimited length.
- Since:
- 4.0
-
Field Summary
FieldsFields inherited from class org.apache.hc.core5.http.impl.nio.AbstractContentEncoder
buffer, channel, completed, metrics -
Constructor Summary
ConstructorsConstructorDescriptionChunkEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics) ChunkEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics, int chunkSizeHint) -
Method Summary
Modifier and TypeMethodDescriptionvoidTerminates the content stream.toString()intwrite(ByteBuffer src) Writes a portion of entity content to the underlying channel.private voidwriteTrailers(List<? extends Header> trailers) Methods inherited from class org.apache.hc.core5.http.impl.nio.AbstractContentEncoder
assertNotCompleted, buffer, channel, complete, flushToChannel, isCompleted, metrics, writeToBuffer, writeToChannel, writeToChannel
-
Field Details
-
chunkSizeHint
private final int chunkSizeHint -
lineBuffer
-
-
Constructor Details
-
ChunkEncoder
public ChunkEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics, int chunkSizeHint) - Parameters:
channel- underlying channel.buffer- session buffer.metrics- transport metrics.- Since:
- 5.0
-
ChunkEncoder
public ChunkEncoder(WritableByteChannel channel, SessionOutputBuffer buffer, BasicHttpTransportMetrics metrics)
-
-
Method Details
-
write
Description copied from interface:ContentEncoderWrites a portion of entity content to the underlying channel.- Parameters:
src- The buffer from which content is to be retrieved- Returns:
- The number of bytes read, possibly zero
- Throws:
IOException- if I/O error occurs while writing content
-
complete
Description copied from interface:ContentEncoderTerminates the content stream.- Specified by:
completein interfaceContentEncoder- Overrides:
completein classAbstractContentEncoder- Throws:
IOException- if I/O error occurs while writing content
-
writeTrailers
- Throws:
IOException
-
toString
-