Pipe class source __nio in Java NiO

Source: Internet
Author: User

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 ();
 }

}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.