Package org.simpleframework.http.core
Class EmptyEncoder
- java.lang.Object
-
- org.simpleframework.http.core.EmptyEncoder
-
- All Implemented Interfaces:
BodyEncoder
class EmptyEncoder extends java.lang.Object implements BodyEncoder
TheEmptyEncoderobject 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
Fields Modifier and Type Field Description private BodyObserverobserverThis is the observer that is used to process the pipeline.private ByteWriterwriterThis is the writer that is passed to the monitor when ready.
-
Constructor Summary
Constructors Constructor Description EmptyEncoder(BodyObserver observer, ByteWriter writer)Constructor for theEmptyEncoderobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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(java.nio.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(java.nio.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 Detail
-
observer
private final BodyObserver observer
This is the observer that is used to process the pipeline.
-
writer
private final ByteWriter writer
This is the writer that is passed to the monitor when ready.
-
-
Constructor Detail
-
EmptyEncoder
public EmptyEncoder(BodyObserver observer, ByteWriter writer)
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:
writer- this is used to send to the underlying transportobserver- this is used to deliver signals to the kernel
-
-
Method Detail
-
encode
public void encode(byte[] array) throws java.io.IOExceptionThis 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:
java.io.IOException
-
encode
public void encode(byte[] array, int off, int size) throws java.io.IOExceptionThis 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:
java.io.IOException
-
encode
public void encode(java.nio.ByteBuffer buffer) throws java.io.IOExceptionThis 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:
java.io.IOException
-
encode
public void encode(java.nio.ByteBuffer buffer, int off, int size) throws java.io.IOExceptionThis 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:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionThis 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:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionThis 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:
java.io.IOException
-
-