Class NhttpSharedOutputBuffer
- java.lang.Object
-
- org.apache.http.nio.util.ExpandableBuffer
-
- org.apache.synapse.transport.nhttp.NhttpSharedOutputBuffer
-
- All Implemented Interfaces:
org.apache.http.io.BufferInfo
,org.apache.http.nio.util.BufferInfo
,org.apache.http.nio.util.ContentOutputBuffer
@Contract(threading=SAFE_CONDITIONAL) public class NhttpSharedOutputBuffer extends org.apache.http.nio.util.ExpandableBuffer implements org.apache.http.nio.util.ContentOutputBuffer
Implementation of theContentOutputBuffer
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 callingproduceContent(ContentEncoder)
.The worker thread is expected to write data to the buffer by calling
write(int)
,write(byte[], int, int)
orwriteCompleted()
In case of an abnormal situation or when no longer needed the buffer must be shut down using
shutdown()
method. Please note thatSharedOutputBuffer
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 Summary
Constructors Constructor Description NhttpSharedOutputBuffer(int buffersize)
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)
NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.util.ByteBufferAllocator allocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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()
-
-
-
Constructor Detail
-
NhttpSharedOutputBuffer
public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.IOControl ioctrl, org.apache.http.nio.util.ByteBufferAllocator allocator, int timeout)
-
NhttpSharedOutputBuffer
@Deprecated public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.IOControl ioctrl, org.apache.http.nio.util.ByteBufferAllocator allocator)
Deprecated.
-
NhttpSharedOutputBuffer
public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.util.ByteBufferAllocator allocator)
-
NhttpSharedOutputBuffer
public NhttpSharedOutputBuffer(int buffersize)
-
-
Method Detail
-
reset
public void reset()
- Specified by:
reset
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
-
hasData
public boolean hasData()
- Overrides:
hasData
in classorg.apache.http.nio.util.ExpandableBuffer
-
available
public int available()
- Specified by:
available
in interfaceorg.apache.http.io.BufferInfo
- Specified by:
available
in interfaceorg.apache.http.nio.util.BufferInfo
- Overrides:
available
in classorg.apache.http.nio.util.ExpandableBuffer
-
capacity
public int capacity()
- Specified by:
capacity
in interfaceorg.apache.http.io.BufferInfo
- Specified by:
capacity
in interfaceorg.apache.http.nio.util.BufferInfo
- Overrides:
capacity
in classorg.apache.http.nio.util.ExpandableBuffer
-
length
public int length()
- Specified by:
length
in interfaceorg.apache.http.io.BufferInfo
- Specified by:
length
in interfaceorg.apache.http.nio.util.BufferInfo
- Overrides:
length
in classorg.apache.http.nio.util.ExpandableBuffer
-
produceContent
@Deprecated public int produceContent(org.apache.http.nio.ContentEncoder encoder) throws IOException
Deprecated.- Specified by:
produceContent
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
- Throws:
IOException
-
produceContent
public int produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) throws IOException
- Throws:
IOException
-
close
public void close()
-
shutdown
public void shutdown()
-
write
public void write(byte[] b, int off, int len) throws IOException
- Specified by:
write
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
- Throws:
IOException
-
writeCompleted
public void writeCompleted() throws IOException
- Specified by:
writeCompleted
in interfaceorg.apache.http.nio.util.ContentOutputBuffer
- Throws:
IOException
-
-