Class SessionOutputBufferImpl
java.lang.Object
org.apache.hc.core5.http.impl.nio.ExpandableBuffer
org.apache.hc.core5.http.impl.nio.SessionOutputBufferImpl
- All Implemented Interfaces:
SessionOutputBuffer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
ExpandableBuffer.Mode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CharBufferprivate final CharsetEncoderprivate static final byte[]private final int -
Constructor Summary
ConstructorsConstructorDescriptionSessionOutputBufferImpl(int bufferSize) SessionOutputBufferImpl(int bufferSize, int lineBufferSize) SessionOutputBufferImpl(int bufferSize, int lineBufferSize, Charset charset) SessionOutputBufferImpl(int bufferSize, int lineBufferSize, CharsetEncoder charEncoder) Creates SessionOutputBufferImpl instance. -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()Returns available capacity of this buffer.intflush(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.private voidwrite(byte[] b) voidwrite(ByteBuffer src) Copies content of the source buffer into this buffer.voidwrite(ReadableByteChannel src) Reads a sequence of bytes from the source channel into this buffer.private voidvoidwriteLine(CharArrayBuffer lineBuffer) Copies content of the source buffer into this buffer as one line of text including a line delimiter.Methods inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
buffer, clear, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString
-
Field Details
-
CRLF
private static final byte[] CRLF -
charEncoder
-
lineBufferSize
private final int lineBufferSize -
charbuffer
-
-
Constructor Details
-
SessionOutputBufferImpl
Creates SessionOutputBufferImpl instance.- Parameters:
bufferSize- input buffer sizelineBufferSize- buffer size for line operations. Has effect only ifcharEncoderis notnull.charEncoder- charEncoder to be used for encoding HTTP protocol elements. Ifnullsimple type cast will be used for char to byte conversion.- Since:
- 4.3
-
SessionOutputBufferImpl
- Since:
- 4.3
-
SessionOutputBufferImpl
public SessionOutputBufferImpl(int bufferSize, int lineBufferSize) - Since:
- 4.3
-
SessionOutputBufferImpl
public SessionOutputBufferImpl(int bufferSize) - Since:
- 4.3
-
-
Method Details
-
length
public int length()Description copied from class:ExpandableBufferReturns the length of this buffer.Sets the mode to output.
- Specified by:
lengthin interfaceSessionOutputBuffer- Overrides:
lengthin classExpandableBuffer- Returns:
- buffer length.
-
hasData
public boolean hasData()Description copied from class:ExpandableBufferDetermines if the buffer contains data.Sets the mode to output.
- Specified by:
hasDatain interfaceSessionOutputBuffer- Overrides:
hasDatain classExpandableBuffer- Returns:
trueif there is data in the buffer,falseotherwise.
-
capacity
public int capacity()Description copied from class:ExpandableBufferReturns available capacity of this buffer.- Specified by:
capacityin interfaceSessionOutputBuffer- Overrides:
capacityin classExpandableBuffer- Returns:
- buffer length.
-
flush
Description copied from interface:SessionOutputBufferMakes an attempt to flush the content of this buffer to the given destinationWritableByteChannel.- Specified by:
flushin interfaceSessionOutputBuffer- Parameters:
channel- the destination channel.- Returns:
- The number of bytes written, possibly zero.
- Throws:
IOException- in case of an I/O error.
-
write
Description copied from interface:SessionOutputBufferCopies 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.- Specified by:
writein interfaceSessionOutputBuffer- Parameters:
src- the source buffer.
-
write
Description copied from interface:SessionOutputBufferReads a sequence of bytes from the source channel into this buffer.- Specified by:
writein interfaceSessionOutputBuffer- Parameters:
src- the source channel.- Throws:
IOException
-
write
private void write(byte[] b) -
writeCRLF
private void writeCRLF() -
writeLine
Description copied from interface:SessionOutputBufferCopies 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.
- Specified by:
writeLinein interfaceSessionOutputBuffer- Parameters:
lineBuffer- the source buffer.- Throws:
CharacterCodingException
-