@ThreadSafe
public class NhttpSharedOutputBuffer
extends org.apache.http.nio.util.ExpandableBuffer
implements org.apache.http.nio.util.ContentOutputBuffer
ContentOutputBuffer interface that can be
shared by multiple threads, usually the I/O dispatch of an I/O reactor and
a worker thread.
The I/O dispatch thread is expected to transfer data from the buffer to
ContentEncoder by calling produceContent(ContentEncoder).
The worker thread is expected to write data to the buffer by calling
write(int), write(byte[], int, int) or writeCompleted()
In case of an abnormal situation or when no longer needed the buffer must be
shut down using shutdown() method.
Please note that SharedOutputBuffer class was copied here renamed as
NhttpSharedOutputBuffer from httpcore-nio in order to fix
https://github.com/wso2/product-ei/issues/1367, without having to do an API change in httpcore-nio component.
| Constructor and Description |
|---|
NhttpSharedOutputBuffer(int buffersize) |
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.util.ByteBufferAllocator allocator) |
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.IOControl ioctrl,
org.apache.http.nio.util.ByteBufferAllocator allocator)
Deprecated.
|
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.IOControl ioctrl,
org.apache.http.nio.util.ByteBufferAllocator allocator,
int timeout) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
int |
capacity() |
void |
close() |
void |
flush() |
boolean |
hasData() |
int |
length() |
int |
produceContent(org.apache.http.nio.ContentEncoder encoder)
Deprecated.
|
int |
produceContent(org.apache.http.nio.ContentEncoder encoder,
org.apache.http.nio.IOControl ioctrl) |
void |
reset() |
void |
shutdown() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeCompleted() |
public NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.IOControl ioctrl,
org.apache.http.nio.util.ByteBufferAllocator allocator,
int timeout)
@Deprecated public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.IOControl ioctrl, org.apache.http.nio.util.ByteBufferAllocator allocator)
public NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.util.ByteBufferAllocator allocator)
public NhttpSharedOutputBuffer(int buffersize)
public void reset()
reset in interface org.apache.http.nio.util.ContentOutputBufferpublic boolean hasData()
hasData in class org.apache.http.nio.util.ExpandableBufferpublic int available()
available in interface org.apache.http.nio.util.BufferInfoavailable in class org.apache.http.nio.util.ExpandableBufferpublic int capacity()
capacity in interface org.apache.http.nio.util.BufferInfocapacity in class org.apache.http.nio.util.ExpandableBufferpublic int length()
length in interface org.apache.http.nio.util.BufferInfolength in class org.apache.http.nio.util.ExpandableBuffer@Deprecated public int produceContent(org.apache.http.nio.ContentEncoder encoder) throws IOException
produceContent in interface org.apache.http.nio.util.ContentOutputBufferIOExceptionpublic int produceContent(org.apache.http.nio.ContentEncoder encoder,
org.apache.http.nio.IOControl ioctrl)
throws IOException
IOExceptionpublic void close()
public void shutdown()
public void write(byte[] b,
int off,
int len)
throws IOException
write in interface org.apache.http.nio.util.ContentOutputBufferIOExceptionpublic void write(byte[] b)
throws IOException
IOExceptionpublic void write(int b)
throws IOException
write in interface org.apache.http.nio.util.ContentOutputBufferIOExceptionpublic void flush()
throws IOException
flush in interface org.apache.http.nio.util.ContentOutputBufferIOExceptionpublic void writeCompleted()
throws IOException
writeCompleted in interface org.apache.http.nio.util.ContentOutputBufferIOExceptionCopyright © 2005–2019 Apache Software Foundation. All rights reserved.