Class SharedOutputBuffer

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

public class SharedOutputBuffer 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 expected to transfer data from the buffer to DataStreamChannel by calling produceContent(DataStreamChannel).

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.

  • 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
    SharedOutputBuffer(int buffersize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    void
     
    int
     
    void
     
    boolean
     
    int
     
    int
    produceContent(org.apache.hc.core5.http.nio.DataStreamChannel stream)
     
    void
     
    void
     
    void
    write(byte[] b)
     
    void
    write(byte[] b, int off, int len)
     
    void
    write(int b)
     
    int
     
    void
     

    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

    • SharedOutputBuffer

      public SharedOutputBuffer(int buffersize)
  • Method Details

    • reset

      public void reset()
    • 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
    • produceContent

      public int produceContent(org.apache.hc.core5.http.nio.DataStreamChannel stream) 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