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 the
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.
-
Field Summary
Fields inherited from class org.apache.http.nio.util.ExpandableBuffer
buffer, INPUT_MODE, OUTPUT_MODE -
Constructor Summary
ConstructorsConstructorDescriptionNhttpSharedOutputBuffer(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
Modifier and TypeMethodDescriptionintintcapacity()voidclose()voidflush()booleanhasData()intlength()intproduceContent(org.apache.http.nio.ContentEncoder encoder) Deprecated.intproduceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) voidreset()voidshutdown()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) voidMethods inherited from class org.apache.http.nio.util.ExpandableBuffer
clear, ensureCapacity, expand, getMode, setInputMode, setOutputMode, toString
-
Constructor Details
-
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 Details
-
reset
public void reset()- Specified by:
resetin interfaceorg.apache.http.nio.util.ContentOutputBuffer
-
hasData
public boolean hasData()- Overrides:
hasDatain classorg.apache.http.nio.util.ExpandableBuffer
-
available
public int available()- Specified by:
availablein interfaceorg.apache.http.io.BufferInfo- Specified by:
availablein interfaceorg.apache.http.nio.util.BufferInfo- Overrides:
availablein classorg.apache.http.nio.util.ExpandableBuffer
-
capacity
public int capacity()- Specified by:
capacityin interfaceorg.apache.http.io.BufferInfo- Specified by:
capacityin interfaceorg.apache.http.nio.util.BufferInfo- Overrides:
capacityin classorg.apache.http.nio.util.ExpandableBuffer
-
length
public int length()- Specified by:
lengthin interfaceorg.apache.http.io.BufferInfo- Specified by:
lengthin interfaceorg.apache.http.nio.util.BufferInfo- Overrides:
lengthin classorg.apache.http.nio.util.ExpandableBuffer
-
produceContent
@Deprecated public int produceContent(org.apache.http.nio.ContentEncoder encoder) throws IOException Deprecated.- Specified by:
produceContentin 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
- Specified by:
writein interfaceorg.apache.http.nio.util.ContentOutputBuffer- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Specified by:
writein interfaceorg.apache.http.nio.util.ContentOutputBuffer- Throws:
IOException
-
flush
- Specified by:
flushin interfaceorg.apache.http.nio.util.ContentOutputBuffer- Throws:
IOException
-
writeCompleted
- Specified by:
writeCompletedin interfaceorg.apache.http.nio.util.ContentOutputBuffer- Throws:
IOException
-