Class SharedOutputBuffer
- java.lang.Object
-
- org.apache.http.nio.util.ExpandableBuffer
-
- org.apache.cxf.transport.http.asyncclient.SharedOutputBuffer
-
- All Implemented Interfaces:
org.apache.http.io.BufferInfo,org.apache.http.nio.util.BufferInfo
public class SharedOutputBuffer extends org.apache.http.nio.util.ExpandableBufferContent buffer 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 toContentEncoderby callingproduceContent(ContentEncoder, IOControl). The worker thread is expected to write data to the buffer by callingwrite(int),write(byte[], int, int)orwriteCompleted()In case of an abnormal situation or when no longer needed the buffer must be shut down usingshutdown()method.
-
-
Constructor Summary
Constructors Constructor Description SharedOutputBuffer(int buffersize, org.apache.http.nio.util.ByteBufferAllocator allocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()intcapacity()voidclose()intcopy(InputStream in)voidflush()booleanhasData()intlength()intproduceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioc)voidreset()voidshutdown()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)intwrite(ByteBuffer b)voidwriteCompleted()
-
-
-
Method Detail
-
reset
public void reset()
-
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
public int produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioc) throws IOException- Throws:
IOException
-
close
public void close()
-
shutdown
public void shutdown()
-
copy
public int copy(InputStream in) throws IOException
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
write
public int write(ByteBuffer b) throws IOException
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Throws:
IOException
-
write
public void write(int b) throws IOException- Throws:
IOException
-
flush
public void flush() throws IOException- Throws:
IOException
-
writeCompleted
public void writeCompleted() throws IOException- Throws:
IOException
-
-