Class PipeChannel

  • All Implemented Interfaces:
    Closeable, Appendable, AutoCloseable, Readable, Channel, ReadableByteChannel, WritableByteChannel

    @Deprecated(since="2021-07-29")
    public class PipeChannel
    extends Object
    implements ReadableByteChannel, WritableByteChannel, Appendable, Readable, Closeable
    Deprecated.
    This API is deprecated as Apache Abdera is a retired project since 2017.
    Implements a buffer that provides a slightly more efficient way of writing, and then reading a stream of bytes. To use: PipeChannel pipe = new PipeChannel(); byte[] bytes = {'a','b','c','d'}; pipe.write(bytes); pipe.close(); InputStream in = pipe.getInputStream(); int i = -1; while ((i = in.read()) != -1) {...} By default, closing will automatically cause it to flip over to Read mode, locking the buffer from further writes and setting the read position to 0. Once the Buffer has been fully read, it must be reset, which sets it back into write mode