Package org.simpleframework.http.message
Class EmptyConsumer
- java.lang.Object
-
- org.simpleframework.http.message.EmptyConsumer
-
- All Implemented Interfaces:
BodyConsumer
,ByteConsumer
public class EmptyConsumer extends java.lang.Object implements BodyConsumer
TheEmptyConsumer
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.
-
-
-
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 asAttachment
objects. Each part can then be read as an individual message.- Specified by:
getBody
in interfaceBodyConsumer
- 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 interfaceByteConsumer
- 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 interfaceByteConsumer
- Returns:
- this will always return true for the zero length body
-
-