Class Pipe

java.lang.Object
java.nio.channels.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.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  Pipe.SinkChannel
    Writable sink channel used to write to a pipe.
    static class  Pipe.SourceChannel
    Readable source channel used to read from a pipe.
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected Pipe()
    The protected default constructor.
  • Method Summary

    Modifier and Type Method Description
    static Pipe open()
    Returns a new pipe from the default {@see java.nio.channels.spi.SelectorProvider}.
    abstract Pipe.SinkChannel sink()
    Returns the sink channel of the pipe.
    abstract Pipe.SourceChannel source()
    Returns the source channel of the pipe.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pipe

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

    • 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.