Package org.apache.http.nio.reactor
Interface SessionOutputBuffer
-
- All Known Implementing Classes:
SessionOutputBufferImpl
public interface SessionOutputBufferSession output buffer for non-blocking connections. This interface facilitates intermediate buffering of output data streamed out to a destination channel and writing data to the buffer from a source, usuallyByteBufferorReadableByteChannel. This interface also provides methods for writing lines of text.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intflush(java.nio.channels.WritableByteChannel channel)Makes an attempt to flush the content of this buffer to the given destinationWritableByteChannel.booleanhasData()Determines if the buffer contains data.intlength()Returns the length of this buffer.voidwrite(java.nio.ByteBuffer src)Copies content of the source buffer into this buffer.voidwrite(java.nio.channels.ReadableByteChannel src)Reads a sequence of bytes from the source channel into this buffer.voidwriteLine(java.lang.String s)Copies content of the given string into this buffer as one line of text including a line delimiter.voidwriteLine(CharArrayBuffer src)Copies content of the source buffer into this buffer as one line of text including a line delimiter.
-
-
-
Method Detail
-
hasData
boolean hasData()
Determines if the buffer contains data.- Returns:
trueif there is data in the buffer,falseotherwise.
-
length
int length()
Returns the length of this buffer.- Returns:
- buffer length.
-
flush
int flush(java.nio.channels.WritableByteChannel channel) throws java.io.IOException
Makes an attempt to flush the content of this buffer to the given destinationWritableByteChannel.- Parameters:
channel- the destination channel.- Returns:
- The number of bytes written, possibly zero.
- Throws:
java.io.IOException- in case of an I/O error.
-
write
void write(java.nio.ByteBuffer src)
Copies content of the source buffer into this buffer. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.- Parameters:
src- the source buffer.
-
write
void write(java.nio.channels.ReadableByteChannel src) throws java.io.IOExceptionReads a sequence of bytes from the source channel into this buffer.- Parameters:
src- the source channel.- Throws:
java.io.IOException
-
writeLine
void writeLine(CharArrayBuffer src) throws java.nio.charset.CharacterCodingException
Copies content of the source buffer into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
- Parameters:
src- the source buffer.- Throws:
java.nio.charset.CharacterCodingException
-
writeLine
void writeLine(java.lang.String s) throws java.io.IOExceptionCopies content of the given string into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire string.The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
- Parameters:
s- the string.- Throws:
java.io.IOException
-
-