Class EmptyConsumer

  • All Implemented Interfaces:
    BodyConsumer, ByteConsumer

    public class EmptyConsumer
    extends java.lang.Object
    implements BodyConsumer
    The EmptyConsumer object is used to represent a body of zero length. This is the most common body consumer created as it represents the body for GET messages that have nothing within the body part.
    • Constructor Summary

      Constructors 
      Constructor Description
      EmptyConsumer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void consume​(ByteCursor cursor)
      This method will not consume any bytes from the cursor.
      Body getBody()
      This is used to acquire the body that has been consumed.
      boolean isFinished()
      This will return true immediately.
      • Methods inherited from class java.lang.Object

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

      • EmptyConsumer

        public EmptyConsumer()
    • Method Detail

      • getBody

        public Body getBody()
        This is used to acquire the body that has been consumed. This will return a body which can be used to read the content of the message, also if the request is multipart upload then all of the parts are provided as Attachment objects. Each part can then be read as an individual message.
        Specified by:
        getBody in interface BodyConsumer
        Returns:
        the body that has been consumed by this instance
      • consume

        public void consume​(ByteCursor cursor)
        This method will not consume any bytes from the cursor. This ensures that the next byte read from the stream is the first character of the next HTTP message within the pipeline.
        Specified by:
        consume in interface ByteConsumer
        Parameters:
        cursor - this is the cursor which will not be read from
      • isFinished

        public boolean isFinished()
        This will return true immediately. Because the empty consumer represents a zero length body and no bytes are read from the cursor, this should not be processed and return finished.
        Specified by:
        isFinished in interface ByteConsumer
        Returns:
        this will always return true for the zero length body