Class AbstractContentDecoder

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected SessionInputBuffer buffer  
      protected java.nio.channels.ReadableByteChannel channel  
      protected boolean completed  
      protected org.apache.http.impl.io.HttpTransportMetricsImpl metrics  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractContentDecoder​(java.nio.channels.ReadableByteChannel channel, SessionInputBuffer buffer, org.apache.http.impl.io.HttpTransportMetricsImpl metrics)
      Creates an instance of this class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int fillBufferFromChannel()
      Reads from the channel to the session buffer.
      boolean isCompleted()
      Returns true if the entity has been received in its entirety.
      protected int readFromChannel​(java.nio.ByteBuffer dst)
      Reads from the channel to the destination.
      protected int readFromChannel​(java.nio.ByteBuffer dst, int limit)
      Reads from the channel to the destination.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • channel

        protected final java.nio.channels.ReadableByteChannel channel
      • metrics

        protected final org.apache.http.impl.io.HttpTransportMetricsImpl metrics
      • completed

        protected boolean completed
    • Constructor Detail

      • AbstractContentDecoder

        public AbstractContentDecoder​(java.nio.channels.ReadableByteChannel channel,
                                      SessionInputBuffer buffer,
                                      org.apache.http.impl.io.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 Detail

      • 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​(java.nio.ByteBuffer dst)
                               throws java.io.IOException
        Reads from the channel to the destination.
        Parameters:
        dst - destination.
        Returns:
        number of bytes transferred.
        Throws:
        java.io.IOException
        Since:
        4.3
      • fillBufferFromChannel

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

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