Class SharedOutputBuffer

  • All Implemented Interfaces:
    org.apache.http.io.BufferInfo, org.apache.http.nio.util.BufferInfo

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

    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.

    • Constructor Detail

      • SharedOutputBuffer

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

      • reset

        public void reset()
      • 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.io.BufferInfo
        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.io.BufferInfo
        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.io.BufferInfo
        Specified by:
        length in interface org.apache.http.nio.util.BufferInfo
        Overrides:
        length in class org.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()