Class AbstractContentDecoder

java.lang.Object
org.apache.http.impl.nio.codecs.AbstractContentDecoder
All Implemented Interfaces:
ContentDecoder
Direct Known Subclasses:
ChunkDecoder, IdentityDecoder, LengthDelimitedDecoder

@NotThreadSafe public abstract class AbstractContentDecoder extends Object implements ContentDecoder
Abstract ContentDecoder that serves as a base for all content decoder implementations.
Since:
4.0
  • Field Details

  • Constructor Details

    • AbstractContentDecoder

      public AbstractContentDecoder(ReadableByteChannel channel, SessionInputBuffer buffer, HttpTransportMetricsImpl metrics)
      Creates an instance of this class.
      Parameters:
      channel - the source channel.
      buffer - the session input buffer that can be used to store session data for intermediate processing.
      metrics - Transport metrics of the underlying HTTP transport.
  • Method Details

    • isCompleted

      public boolean isCompleted()
      Description copied from interface: ContentDecoder
      Returns true if the entity has been received in its entirety.
      Specified by:
      isCompleted in interface ContentDecoder
      Returns:
      true if all the content has been consumed, false otherwise.
    • readFromChannel

      protected int readFromChannel(ByteBuffer dst) throws IOException
      Reads from the channel to the destination.
      Parameters:
      dst - destination.
      Returns:
      number of bytes transferred.
      Throws:
      IOException
      Since:
      4.3
    • fillBufferFromChannel

      protected int fillBufferFromChannel() throws IOException
      Reads from the channel to the session buffer.
      Returns:
      number of bytes transferred.
      Throws:
      IOException
      Since:
      4.3
    • readFromChannel

      protected int readFromChannel(ByteBuffer dst, int limit) throws IOException
      Reads from the channel to the destination.
      Parameters:
      dst - destination.
      limit - max number of bytes to transfer.
      Returns:
      number of bytes transferred.
      Throws:
      IOException
      Since:
      4.3