Top Description Fields Constructors Methods
org.apache.http.impl.io

public abstract Class AbstractSessionOutputBuffer

extends Object
implements SessionOutputBuffer, BufferInfo
Class Inheritance
All Implemented Interfaces
org.apache.http.io.BufferInfo, org.apache.http.io.SessionOutputBuffer
Known Direct Subclasses
org.apache.http.impl.io.SocketOutputBuffer
Annotations
@Deprecated
Imports
java.io.IOException, .OutputStream, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetEncoder, .CoderResult, .CodingErrorAction, org.apache.http.Consts, org.apache.http.io.BufferInfo, .HttpTransportMetrics, .SessionOutputBuffer, org.apache.http.params.CoreConnectionPNames, .CoreProtocolPNames, .HttpParams, org.apache.http.protocol.HTTP, org.apache.http.util.Args, .ByteArrayBuffer, .CharArrayBuffer

Deprecated

(4.3) use SessionOutputBufferImpl

Abstract base class for session output buffers that stream data to an arbitrary OutputStream. This class buffers small chunks of output data in an internal byte array for optimal output performance.

writeLine(CharArrayBuffer) and writeLine(String) methods of this class use CR-LF as a line delimiter.

Since
4.0

Field Summary

Modifier and TypeField and Description
private boolean
private ByteBuffer
private ByteArrayBuffer
private Charset
private static final byte[]
private CharsetEncoder
private HttpTransportMetricsImpl
private int
private CodingErrorAction
private CodingErrorAction
private OutputStream

Constructor Summary

AccessConstructor and Description
protected
AbstractSessionOutputBuffer(final OutputStream outStream, final int bufferSize, final Charset charset, final int minChunkLimit, final CodingErrorAction malformedCharAction, final CodingErrorAction unmappableCharAction)

public

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.apache.http.io.BufferInfo.available.

Returns available space in the buffer.
public int
capacity()

Implements org.apache.http.io.BufferInfo.capacity.

Returns total capacity of the buffer
protected HttpTransportMetricsImpl
public void
flush()

Implements org.apache.http.io.SessionOutputBuffer.flush.

Flushes this session buffer and forces any buffered output bytes to be written out.
protected void
public HttpTransportMetrics
private void
protected void
init(final OutputStream outStream, final int bufferSize, final HttpParams params)

Deprecated as a consequence of HttpParams being deprecated.
public int
length()

Implements org.apache.http.io.BufferInfo.length.

Return length data stored in the buffer
public void
write(final byte[]
the data.
b
,
final int
the start offset in the data.
off
,
final int
the number of bytes to write.
len
)

Implements org.apache.http.io.SessionOutputBuffer.write.

Writes len bytes from the specified byte array starting at offset off to this session buffer.
public void
write(final byte[]
the data.
b
)

Implements org.apache.http.io.SessionOutputBuffer.write.

Writes b.length bytes from the specified byte array to this session buffer.
public void
write(final int
the byte.
b
)

Implements org.apache.http.io.SessionOutputBuffer.write.

Writes the specified byte to this session buffer.
private void
public void
writeLine(final String
the line.
s
)

Implements org.apache.http.io.SessionOutputBuffer.writeLine.

Writes characters from the specified string followed by a line delimiter to this session buffer.
public void
writeLine(final CharArrayBuffer
the buffer containing chars of the line.
charbuffer
)

Implements org.apache.http.io.SessionOutputBuffer.writeLine.

Writes characters from the specified char array followed by a line delimiter to this session buffer.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

asciiback to summary
private boolean ascii
bbufback to summary
private ByteBuffer bbuf
bufferback to summary
private ByteArrayBuffer buffer
charsetback to summary
private Charset charset
CRLFback to summary
private static final byte[] CRLF
encoderback to summary
private CharsetEncoder encoder
metricsback to summary
private HttpTransportMetricsImpl metrics
minChunkLimitback to summary
private int minChunkLimit
onMalformedCharActionback to summary
private CodingErrorAction onMalformedCharAction
onUnmappableCharActionback to summary
private CodingErrorAction onUnmappableCharAction
outStreamback to summary
private OutputStream outStream

Constructor Detail

AbstractSessionOutputBufferback to summary
protected AbstractSessionOutputBuffer(final OutputStream outStream, final int bufferSize, final Charset charset, final int minChunkLimit, final CodingErrorAction malformedCharAction, final CodingErrorAction unmappableCharAction)
AbstractSessionOutputBufferback to summary
public AbstractSessionOutputBuffer()

Method Detail

availableback to summary
public int available()

Implements org.apache.http.io.BufferInfo.available.

Doc from org.apache.http.io.BufferInfo.available.

Returns available space in the buffer.

Returns:int

available space.

Annotations
@Override
Since
4.1
capacityback to summary
public int capacity()

Implements org.apache.http.io.BufferInfo.capacity.

Doc from org.apache.http.io.BufferInfo.capacity.

Returns total capacity of the buffer

Returns:int

total capacity

Annotations
@Override
Since
4.1
createTransportMetricsback to summary
protected HttpTransportMetricsImpl createTransportMetrics()
Since
4.1
flushback to summary
public void flush() throws IOException

Implements org.apache.http.io.SessionOutputBuffer.flush.

Doc from org.apache.http.io.SessionOutputBuffer.flush.

Flushes this session buffer and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
flushBufferback to summary
protected void flushBuffer() throws IOException
getMetricsback to summary
public HttpTransportMetrics getMetrics()

Implements org.apache.http.io.SessionOutputBuffer.getMetrics.

Doc from org.apache.http.io.SessionOutputBuffer.getMetrics.

Returns HttpTransportMetrics for this session buffer.

Returns:HttpTransportMetrics

transport metrics.

Annotations
@Override
handleEncodingResultback to summary
private void handleEncodingResult(final CoderResult result) throws IOException
initback to summary
protected void init(final OutputStream outStream, final int bufferSize, final HttpParams params)

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

lengthback to summary
public int length()

Implements org.apache.http.io.BufferInfo.length.

Doc from org.apache.http.io.BufferInfo.length.

Return length data stored in the buffer

Returns:int

data length

Annotations
@Override
Since
4.1
writeback to summary
public void write(final byte[] b, final int off, final int len) throws IOException

Implements org.apache.http.io.SessionOutputBuffer.write.

Doc from org.apache.http.io.SessionOutputBuffer.write.

Writes len bytes from the specified byte array starting at offset off to this session buffer.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(final byte[] b) throws IOException

Implements org.apache.http.io.SessionOutputBuffer.write.

Doc from org.apache.http.io.SessionOutputBuffer.write.

Writes b.length bytes from the specified byte array to this session buffer.

Parameters
b:byte[]

the data.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(final int b) throws IOException

Implements org.apache.http.io.SessionOutputBuffer.write.

Doc from org.apache.http.io.SessionOutputBuffer.write.

Writes the specified byte to this session buffer.

Parameters
b:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeEncodedback to summary
private void writeEncoded(final CharBuffer cbuf) throws IOException
writeLineback to summary
public void writeLine(final String s) throws IOException

Implements org.apache.http.io.SessionOutputBuffer.writeLine.

Writes characters from the specified string followed by a line delimiter to this session buffer.

This method uses CR-LF as a line delimiter.

Parameters
s:String

the line.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeLineback to summary
public void writeLine(final CharArrayBuffer charbuffer) throws IOException

Implements org.apache.http.io.SessionOutputBuffer.writeLine.

Writes characters from the specified char array followed by a line delimiter to this session buffer.

This method uses CR-LF as a line delimiter.

Parameters
charbuffer:CharArrayBuffer

the buffer containing chars of the line.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.