java.nio.channels
Class Pipe

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.nio.channels.Pipe

public abstract class Pipe
extends Object sample code for java.lang.Object definition code for java.lang.Object

A pair of channels that implements a unidirectional pipe.

A pipe consists of a pair of channels: A writable sink sample code for java.nio.channels.Pipe.SinkChannel definition code for java.nio.channels.Pipe.SinkChannel channel and a readable source sample code for java.nio.channels.Pipe.SourceChannel definition code for java.nio.channels.Pipe.SourceChannel channel. Once some bytes are written to the sink channel they can be read from source channel in exactly the order in which they were written.

Whether or not a thread writing bytes to a pipe will block until another thread reads those bytes, or some previously-written bytes, from the pipe is system-dependent and therefore unspecified. Many pipe implementations will buffer up to a certain number of bytes between the sink and source channels, but such buffering should not be assumed.

Since:
1.4

Nested Class Summary
static class Pipe.SinkChannel sample code for java.nio.channels.Pipe.SinkChannel definition code for java.nio.channels.Pipe.SinkChannel
          A channel representing the writable end of a Pipe sample code for java.nio.channels.Pipe definition code for java.nio.channels.Pipe .
static class Pipe.SourceChannel sample code for java.nio.channels.Pipe.SourceChannel definition code for java.nio.channels.Pipe.SourceChannel
          A channel representing the readable end of a Pipe sample code for java.nio.channels.Pipe definition code for java.nio.channels.Pipe .
 
Constructor Summary
protected Pipe sample code for java.nio.channels.Pipe.Pipe() definition code for java.nio.channels.Pipe.Pipe() ()
          Initializes a new instance of this class.
 
Method Summary
static Pipe sample code for java.nio.channels.Pipe definition code for java.nio.channels.Pipe open sample code for java.nio.channels.Pipe.open() definition code for java.nio.channels.Pipe.open() ()
          Opens a pipe.
abstract  Pipe.SinkChannel sample code for java.nio.channels.Pipe.SinkChannel definition code for java.nio.channels.Pipe.SinkChannel sink sample code for java.nio.channels.Pipe.sink() definition code for java.nio.channels.Pipe.sink() ()
          Returns this pipe's sink channel.
abstract  Pipe.SourceChannel sample code for java.nio.channels.Pipe.SourceChannel definition code for java.nio.channels.Pipe.SourceChannel source sample code for java.nio.channels.Pipe.source() definition code for java.nio.channels.Pipe.source() ()
          Returns this pipe's source channel.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Pipe sample code for java.nio.channels.Pipe() definition code for java.nio.channels.Pipe()

protected Pipe()
Initializes a new instance of this class.

Method Detail

source sample code for java.nio.channels.Pipe.source() definition code for java.nio.channels.Pipe.source()

public abstract Pipe.SourceChannel sample code for java.nio.channels.Pipe.SourceChannel definition code for java.nio.channels.Pipe.SourceChannel  source()
Returns this pipe's source channel.

Returns:
This pipe's source channel

sink sample code for java.nio.channels.Pipe.sink() definition code for java.nio.channels.Pipe.sink()

public abstract Pipe.SinkChannel sample code for java.nio.channels.Pipe.SinkChannel definition code for java.nio.channels.Pipe.SinkChannel  sink()
Returns this pipe's sink channel.

Returns:
This pipe's sink channel

open sample code for java.nio.channels.Pipe.open() definition code for java.nio.channels.Pipe.open()

public static Pipe sample code for java.nio.channels.Pipe definition code for java.nio.channels.Pipe  open()
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Opens a pipe.

The new pipe is created by invoking the openPipe sample code for java.nio.channels.spi.SelectorProvider.openPipe() definition code for java.nio.channels.spi.SelectorProvider.openPipe() method of the system-wide default SelectorProvider sample code for java.nio.channels.spi.SelectorProvider definition code for java.nio.channels.spi.SelectorProvider object.

Returns:
A new pipe
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error occurs