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 TypeMethodDescriptionvoidconsume(ByteCursor cursor) This method will not consume any bytes from the cursor.getBody()This is used to acquire the body that has been consumed.booleanThis 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 asAttachmentobjects. Each part can then be read as an individual message.- Specified by:
getBodyin 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:
consumein 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:
isFinishedin interfaceByteConsumer- Returns:
- this will always return true for the zero length body
-