Java NiO in the pipe class source code
/** * A pair of channels that implements a unidirectional pipe. * <p> A pipe consists of a pair of channels:a writable {@link * Pipe.sinkchannel </code>sink<code>} Channel and a readable {@link * Pipe.sourcechannel </code>source<code>} channel. Once some bytes are * written to the sink channel they can is read from source channel into exactly * the order in which T
Hey were written. * * <p> Whether or not a thread writing bytes to a pipe would block until another * thread reads those Me previously-written bytes, from the pipe is * system-dependent and therefore unspecified. Many PIPE implementations'll * buffer up to a certain number of bytes between the sink and source channels, * but such Buffering should not to be assumed. </p> * Public abstract class Pipe {public static abstract class Sourcechannel extends Abstractselectab Lechannel implements Readablebytechannel, Scatteringbytechannel {protectEd Sourcechannel (Selectorprovider provider) {super (provider);
Public final int Validops () {return selectionkey.op_read; } public static abstract class Sinkchannel extends Abstractselectablechannel implements Writablebytechannel,
Gatheringbytechannel {protected Sinkchannel (Selectorprovider provider) {super (provider);
Public final int Validops () {return selectionkey.op_write;
} protected Pipe () {} public abstract Sourcechannel source ();
Public abstract Sinkchannel sink ();
public static Pipe open () throws IOException {return Selectorprovider.provider (). Openpipe ();
}
}