Class SharedInputBuffer

java.lang.Object
org.apache.hc.core5.http.impl.nio.ExpandableBuffer
org.apache.cxf.transport.http.asyncclient.hc5.SharedInputBuffer

public class SharedInputBuffer extends org.apache.hc.core5.http.impl.nio.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 ByteBuffer to the buffer by calling #consumeContent(ByteBuffer).

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.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer

    org.apache.hc.core5.http.impl.nio.ExpandableBuffer.Mode
  • Constructor Summary

    Constructors
    Constructor
    Description
    SharedInputBuffer(int buffersize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    void
     
    int
    consumeContent(ByteBuffer buffer, boolean last)
     
    boolean
     
    protected boolean
     
    protected boolean
     
    int
     
    int
     
    int
    read(byte[] b)
     
    int
    read(byte[] b, int off, int len)
     
    void
     
    void
     
    protected void
    waitForData(int waitPos)
     

    Methods inherited from class org.apache.hc.core5.http.impl.nio.ExpandableBuffer

    buffer, clear, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SharedInputBuffer

      public SharedInputBuffer(int buffersize)
  • Method Details

    • reset

      public void reset()
    • consumeContent

      public int consumeContent(ByteBuffer buffer, boolean last) throws IOException
      Throws:
      IOException
    • hasData

      public boolean hasData()
      Overrides:
      hasData in class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
    • capacity

      public int capacity()
      Overrides:
      capacity in class org.apache.hc.core5.http.impl.nio.ExpandableBuffer
    • length

      public int length()
      Overrides:
      length in class org.apache.hc.core5.http.impl.nio.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