Package org.simpleframework.http.core
Class EmptyEncoder
java.lang.Object
org.simpleframework.http.core.EmptyEncoder
- All Implemented Interfaces:
BodyEncoder
The
EmptyEncoder object is a producer used if there
is not response body to be delivered. Typically this is used when
the HTTP request method is HEAD or if there is some status code
sent to the client that does not require a response body.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BodyObserverThis is the observer that is used to process the pipeline.private final ByteWriterThis is the writer that is passed to the monitor when ready. -
Constructor Summary
ConstructorsConstructorDescriptionEmptyEncoder(BodyObserver observer, ByteWriter writer) Constructor for theEmptyEncoderobject. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method performs no operation.voidencode(byte[] array) This method performs no operation.voidencode(byte[] array, int off, int size) This method performs no operation.voidencode(ByteBuffer buffer) This method is used to encode the provided buffer of bytes in a HTTP/1.1 compliant format and sent it to the client.voidencode(ByteBuffer buffer, int off, int size) This method is used to encode the provided buffer of bytes in a HTTP/1.1 compliant format and sent it to the client.voidflush()This method performs no operation.
-
Field Details
-
observer
This is the observer that is used to process the pipeline. -
writer
This is the writer that is passed to the monitor when ready.
-
-
Constructor Details
-
EmptyEncoder
Constructor for theEmptyEncoderobject. Once created this producer will signal the kernel the the next request is ready to read from the HTTP pipeline as there is no content to be delivered with this producer object.- Parameters:
observer- this is used to deliver signals to the kernelwriter- this is used to send to the underlying transport
-
-
Method Details
-
encode
This method performs no operation. Because this producer is not required to generate a response body this will ignore all data that is provided to sent to the underlying transport.- Specified by:
encodein interfaceBodyEncoder- Parameters:
array- this is the array of bytes to send to the client- Throws:
IOException
-
encode
This method performs no operation. Because this producer is not required to generate a response body this will ignore all data that is provided to sent to the underlying transport.- Specified by:
encodein interfaceBodyEncoder- Parameters:
array- this is the array of bytes to send to the clientoff- this is the offset within the array to send fromsize- this is the number of bytes that are to be sent- Throws:
IOException
-
encode
This method is used to encode the provided buffer of bytes in a HTTP/1.1 compliant format and sent it to the client. Once the data has been encoded it is handed to the transport layer within the server, which may choose to buffer the data if the content is too small to send efficiently or if the socket is not write ready.- Specified by:
encodein interfaceBodyEncoder- Parameters:
buffer- this is the buffer of bytes to send to the client- Throws:
IOException
-
encode
This method is used to encode the provided buffer of bytes in a HTTP/1.1 compliant format and sent it to the client. Once the data has been encoded it is handed to the transport layer within the server, which may choose to buffer the data if the content is too small to send efficiently or if the socket is not write ready.- Specified by:
encodein interfaceBodyEncoder- Parameters:
buffer- this is the buffer of bytes to send to the clientoff- this is the offset within the buffer to send fromsize- this is the number of bytes that are to be sent- Throws:
IOException
-
flush
This method performs no operation. Because this producer is not required to generate a response body this will ignore all data that is provided to sent to the underlying transport.- Specified by:
flushin interfaceBodyEncoder- Throws:
IOException
-
close
This method performs no operation. Because this producer is not required to generate a response body this will ignore all data that is provided to sent to the underlying transport.- Specified by:
closein interfaceBodyEncoder- Throws:
IOException
-