Class EmptyConsumer

java.lang.Object
org.simpleframework.http.message.EmptyConsumer
All Implemented Interfaces:
BodyConsumer, ByteConsumer

public class EmptyConsumer extends 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 Details

    • EmptyConsumer

      public EmptyConsumer()
  • Method Details

    • 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