Apache CXF API

org.apache.cxf.transport.http.asyncclient
Class SharedInputBuffer

java.lang.Object
  extended by org.apache.http.nio.util.ExpandableBuffer
      extended by org.apache.cxf.transport.http.asyncclient.SharedInputBuffer
All Implemented Interfaces:
org.apache.http.nio.util.BufferInfo

@ThreadSafe
public class SharedInputBuffer
extends org.apache.http.nio.util.ExpandableBuffer

Content 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 expect to transfer data from ContentDecoder to the buffer by calling #consumeContent(ContentDecoder).

The worker thread is expected to read the data from the buffer by calling read() or read(byte[], int, int) methods.

In case of an abnormal situation or when no longer needed the buffer must be shut down using shutdown() method.


Field Summary
 
Fields inherited from class org.apache.http.nio.util.ExpandableBuffer
buffer, INPUT_MODE, OUTPUT_MODE
 
Constructor Summary
SharedInputBuffer(int buffersize, org.apache.http.nio.util.ByteBufferAllocator allocator)
           
 
Method Summary
 int available()
           
 int capacity()
           
 void close()
           
 int consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioc)
           
 boolean hasData()
           
protected  boolean isEndOfStream()
           
protected  boolean isShutdown()
           
 int length()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 void shutdown()
           
protected  void waitForData(int waitPos)
           
 
Methods inherited from class org.apache.http.nio.util.ExpandableBuffer
clear, ensureCapacity, expand, getMode, setInputMode, setOutputMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SharedInputBuffer

public SharedInputBuffer(int buffersize,
                         org.apache.http.nio.util.ByteBufferAllocator allocator)
Method Detail

reset

public void reset()

consumeContent

public int consumeContent(org.apache.http.nio.ContentDecoder decoder,
                          org.apache.http.nio.IOControl ioc)
                   throws IOException
Throws:
IOException

hasData

public boolean hasData()
Overrides:
hasData in class org.apache.http.nio.util.ExpandableBuffer

available

public int available()
Specified by:
available in interface org.apache.http.nio.util.BufferInfo
Overrides:
available in class org.apache.http.nio.util.ExpandableBuffer

capacity

public int capacity()
Specified by:
capacity in interface org.apache.http.nio.util.BufferInfo
Overrides:
capacity in class org.apache.http.nio.util.ExpandableBuffer

length

public int length()
Specified by:
length in interface org.apache.http.nio.util.BufferInfo
Overrides:
length in class org.apache.http.nio.util.ExpandableBuffer

waitForData

protected void waitForData(int waitPos)
                    throws IOException
Throws:
IOException

close

public void close()

shutdown

public void shutdown()

isShutdown

protected boolean isShutdown()

isEndOfStream

protected boolean isEndOfStream()

read

public int read()
         throws IOException
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Throws:
IOException

Apache CXF API

Apache CXF