Package org.simpleframework.http.message
Class EmptyConsumer
java.lang.Object
org.simpleframework.http.message.EmptyConsumer
- All Implemented Interfaces:
BodyConsumer
,ByteConsumer
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
consume
(ByteCursor cursor) This method will not consume any bytes from the cursor.getBody()
This is used to acquire the body that has been consumed.boolean
This will return true immediately.
-
Constructor Details
-
EmptyConsumer
public EmptyConsumer()
-
-
Method Details
-
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
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
-