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

public abstract Class AbstractContentDecoder

extends Object
implements ContentDecoder
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.nio.ContentDecoder
Known Direct Subclasses
org.apache.hc.core5.http.impl.nio.ChunkDecoder, org.apache.hc.core5.http.impl.nio.IdentityDecoder, org.apache.hc.core5.http.impl.nio.LengthDelimitedDecoder
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.ReadableByteChannel, java.util.List, org.apache.hc.core5.http.Header, org.apache.hc.core5.http.impl.BasicHttpTransportMetrics, org.apache.hc.core5.http.nio.ContentDecoder, .SessionInputBuffer, org.apache.hc.core5.util.Args

Abstract ContentDecoder that serves as a base for all content decoder implementations.
Since
4.0

Field Summary

Modifier and TypeField and Description
pack-priv final SessionInputBuffer
pack-priv final ReadableByteChannel
protected boolean
pack-priv final BasicHttpTransportMetrics

Constructor Summary

AccessConstructor and Description
public
AbstractContentDecoder(final ReadableByteChannel
the source channel.
channel
,
final SessionInputBuffer
the session input buffer that can be used to store session data for intermediate processing.
buffer
,
final BasicHttpTransportMetrics
Transport metrics of the underlying HTTP transport.
metrics
)

Creates an instance of this class.

Method Summary

Modifier and TypeMethod and Description
protected SessionInputBuffer
protected ReadableByteChannel
protected int

Returns:

number of bytes transferred.
fillBufferFromChannel
()

Reads from the channel to the session buffer.

public List<? extends Header>
getTrailers()

Implements org.apache.hc.core5.http.nio.ContentDecoder.getTrailers.

Returns content trailers if available
public boolean
isCompleted()

Implements org.apache.hc.core5.http.nio.ContentDecoder.isCompleted.

Returns true if the entity has been received in its entirety.
protected BasicHttpTransportMetrics
protected int

Returns:

number of bytes transferred.
readFromChannel
(final ByteBuffer
destination.
dst
)

Reads from the channel to the destination.

protected int

Returns:

number of bytes transferred.
readFromChannel
(final ByteBuffer
destination.
dst
,
final int
max number of bytes to transfer.
limit
)

Reads from the channel to the destination.

public void
setCompleted(final boolean
the completed status of this decoder.
completed
)

Sets the completed status of this decoder.

protected void
setCompleted()

Sets the completed status of this decoder to true.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
pack-priv final SessionInputBuffer buffer
channelback to summary
pack-priv final ReadableByteChannel channel
completedback to summary
protected boolean completed
metricsback to summary
pack-priv final BasicHttpTransportMetrics metrics

Constructor Detail

AbstractContentDecoderback to summary
public AbstractContentDecoder(final ReadableByteChannel channel, final SessionInputBuffer buffer, final BasicHttpTransportMetrics metrics)

Creates an instance of this class.

Parameters
channel:ReadableByteChannel

the source channel.

buffer:SessionInputBuffer

the session input buffer that can be used to store session data for intermediate processing.

metrics:BasicHttpTransportMetrics

Transport metrics of the underlying HTTP transport.

Method Detail

bufferback to summary
protected SessionInputBuffer buffer()
channelback to summary
protected ReadableByteChannel channel()
fillBufferFromChannelback to summary
protected int fillBufferFromChannel() throws IOException

Reads from the channel to the session buffer.

Returns:int

number of bytes transferred.

Since
4.3
getTrailersback to summary
public List<? extends Header> getTrailers()

Implements org.apache.hc.core5.http.nio.ContentDecoder.getTrailers.

Doc from org.apache.hc.core5.http.nio.ContentDecoder.getTrailers.

Returns content trailers if available

Returns:List<? extends Header>

list of trailers

Annotations
@Override
isCompletedback to summary
public boolean isCompleted()

Implements org.apache.hc.core5.http.nio.ContentDecoder.isCompleted.

Doc from org.apache.hc.core5.http.nio.ContentDecoder.isCompleted.

Returns true if the entity has been received in its entirety.

Returns:boolean

true if all the content has been consumed, false otherwise.

Annotations
@Override
metricsback to summary
protected BasicHttpTransportMetrics metrics()
readFromChannelback to summary
protected int readFromChannel(final ByteBuffer dst) throws IOException

Reads from the channel to the destination.

Parameters
dst:ByteBuffer

destination.

Returns:int

number of bytes transferred.

Since
4.3
readFromChannelback to summary
protected int readFromChannel(final ByteBuffer dst, final int limit) throws IOException

Reads from the channel to the destination.

Parameters
dst:ByteBuffer

destination.

limit:int

max number of bytes to transfer.

Returns:int

number of bytes transferred.

Since
4.3
setCompletedback to summary
public void setCompleted(final boolean completed)

Sets the completed status of this decoder. Normally this is not necessary (the decoder will automatically complete when the underlying channel returns EOF). It is useful to mark the decoder as completed if you have some other means to know all the necessary data has been read and want to reuse the underlying connection for more messages.

Parameters
completed:boolean

the completed status of this decoder.

Since
4.4.11
setCompletedback to summary
protected void setCompleted()

Sets the completed status of this decoder to true. Normally this is not necessary (the decoder will automatically complete when the underlying channel returns EOF). It is useful to mark the decoder as completed if you have some other means to know all the necessary data has been read and want to reuse the underlying connection for more messages.

Since
4.4.11