Top Description Fields Constructors Methods
org.apache.hc.core5.http.impl.nio

public Class ChunkEncoder

extends AbstractContentEncoder
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.WritableByteChannel, java.util.List, org.apache.hc.core5.http.FormattedHeader, .Header, org.apache.hc.core5.http.impl.BasicHttpTransportMetrics, org.apache.hc.core5.http.message.BasicLineFormatter, org.apache.hc.core5.http.nio.SessionOutputBuffer, org.apache.hc.core5.util.CharArrayBuffer

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

Modifier and TypeField and Description
private final int
private final CharArrayBuffer
Inherited from org.apache.hc.core5.http.impl.nio.AbstractContentEncoder:
bufferchannelcompletedmetrics

Constructor Summary

AccessConstructor and Description
public
ChunkEncoder(final WritableByteChannel
underlying channel.
channel
,
final SessionOutputBuffer
session buffer.
buffer
,
final BasicHttpTransportMetrics
transport metrics.
metrics
,
final int chunkSizeHint)

public

Method Summary

Modifier and TypeMethod and Description
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public int
write(final ByteBuffer
The buffer from which content is to be retrieved
src
)

Implements org.apache.hc.core5.http.nio.ContentEncoder.write.

Writes a portion of entity content to the underlying channel.
private void
writeTrailers(final List<? extends Header> trailers)

Inherited from org.apache.hc.core5.http.impl.nio.AbstractContentEncoder:
assertNotCompletedbufferchannelcompleteflushToChannelisCompletedmetricswriteToBufferwriteToChannelwriteToChannel

Field Detail

chunkSizeHintback to summary
private final int chunkSizeHint
lineBufferback to summary
private final CharArrayBuffer lineBuffer

Constructor Detail

ChunkEncoderback to summary
public ChunkEncoder(final WritableByteChannel channel, final SessionOutputBuffer buffer, final BasicHttpTransportMetrics metrics, final int chunkSizeHint)
Parameters
channel:WritableByteChannel

underlying channel.

buffer:SessionOutputBuffer

session buffer.

metrics:BasicHttpTransportMetrics

transport metrics.

Since
5.0
ChunkEncoderback to summary
public ChunkEncoder(final WritableByteChannel channel, final SessionOutputBuffer buffer, final BasicHttpTransportMetrics metrics)

Method Detail

completeback to summary
public void complete(final List<? extends Header> trailers) throws IOException

Overrides org.apache.hc.core5.http.impl.nio.AbstractContentEncoder.complete.

Implements org.apache.hc.core5.http.nio.ContentEncoder.complete.

Doc from org.apache.hc.core5.http.nio.ContentEncoder.complete.

Terminates the content stream.

Annotations
@Override
Exceptions
IOException:
if I/O error occurs while writing content
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeback to summary
public int write(final ByteBuffer src) throws IOException

Implements org.apache.hc.core5.http.nio.ContentEncoder.write.

Doc from org.apache.hc.core5.http.nio.ContentEncoder.write.

Writes a portion of entity content to the underlying channel.

Parameters
src:ByteBuffer

The buffer from which content is to be retrieved

Returns:int

The number of bytes read, possibly zero

Annotations
@Override
Exceptions
IOException:
if I/O error occurs while writing content
writeTrailersback to summary
private void writeTrailers(final List<? extends Header> trailers) throws IOException