Package java.nio.channels
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 classPipe.SinkChannelWritable sink channel used to write to a pipe.static classPipe.SourceChannelReadable source channel used to read from a pipe. -
Constructor Summary
Constructors Modifier Constructor Description protectedPipe()The protected default constructor. -
Method Summary
Modifier and Type Method Description static Pipeopen()Returns a new pipe from the default {@see java.nio.channels.spi.SelectorProvider}.abstract Pipe.SinkChannelsink()Returns the sink channel of the pipe.abstract Pipe.SourceChannelsource()Returns the source channel of the pipe.
-
Constructor Details
-
Pipe
protected Pipe()The protected default constructor.
-
-
Method Details
-
open
Returns a new pipe from the default {@see java.nio.channels.spi.SelectorProvider}.- Throws:
IOException- if an I/O error occurs.
-
sink
Returns the sink channel of the pipe.- Returns:
- a writable sink channel of the pipe.
-
source
Returns the source channel of the pipe.- Returns:
- a readable source channel of the pipe.
-