Class ByteBufferOutputStream2

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    @Deprecated(since="2021-05-27")
    public class ByteBufferOutputStream2
    extends OutputStream
    Deprecated.
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
    This class implements an output stream in which the data is written into a list of ByteBuffer, the buffer list automatically grows as data is written to it, the buffers are taken from the supplied ByteBufferPool or freshly allocated if one is not supplied. Designed to mimic ByteArrayOutputStream but with better memory usage, and less copying.
    • Constructor Detail

      • ByteBufferOutputStream2

        public ByteBufferOutputStream2()
        Deprecated.
      • ByteBufferOutputStream2

        public ByteBufferOutputStream2​(ByteBufferPool bufferPool,
                                       boolean direct)
        Deprecated.
    • Method Detail

      • getByteBufferPool

        public ByteBufferPool getByteBufferPool()
        Deprecated.
      • takeByteBuffer

        public ByteBuffer takeByteBuffer()
        Deprecated.
        Take the combined buffer containing all content written to the OutputStream. The caller is responsible for releasing this ByteBuffer back into the ByteBufferPool.
        Returns:
        a buffer containing all content written to the OutputStream.
      • toByteBuffer

        public ByteBuffer toByteBuffer()
        Deprecated.
        Take the combined buffer containing all content written to the OutputStream. The returned buffer is still contained within the OutputStream and will be released back to the ByteBufferPool when the OutputStream is closed.
        Returns:
        a buffer containing all content written to the OutputStream.
      • toByteArray

        public byte[] toByteArray()
        Deprecated.
        Returns:
        a newly allocated byte array containing all content written into the OutputStream.
      • size

        public int size()
        Deprecated.
      • write

        public void write​(int b)
        Deprecated.
        Specified by:
        write in class OutputStream
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
        Deprecated.
        Overrides:
        write in class OutputStream
      • write

        public void write​(ByteBuffer buffer)
        Deprecated.
      • writeTo

        public void writeTo​(ByteBuffer buffer)
        Deprecated.