Class Pipe


  • public abstract class Pipe
    extends Object
    A pipe contains two channels, forming a unidirectional pipe. One is the writable sink channel, and the other is the readable source channel. When bytes are written into the writable channel they can be read from the readable channel. Bytes are read in the order in which they were written.
    • Constructor Detail

      • Pipe

        protected Pipe()
        The protected default constructor.
    • Method Detail

      • open

        public static Pipe open()
                         throws IOException
        Returns a new pipe from the default {@see java.nio.channels.spi.SelectorProvider}.
        Throws:
        IOException - if an I/O error occurs.
      • sink

        public abstract Pipe.SinkChannel sink()
        Returns the sink channel of the pipe.
        Returns:
        a writable sink channel of the pipe.
      • source

        public abstract Pipe.SourceChannel source()
        Returns the source channel of the pipe.
        Returns:
        a readable source channel of the pipe.