Package java.nio.channels.spi

Examples of java.nio.channels.spi.SelectorProvider.openPipe()


        sinkChannel.close();
    }

    private static void testReadableByteChannel(int size) throws Exception {
        SelectorProvider sp = SelectorProvider.provider();
        Pipe p = sp.openPipe();
        Pipe.SinkChannel sink = p.sink();
        Pipe.SourceChannel source = p.source();
        sink.configureBlocking(false);

        ByteBuffer outgoingdata = ByteBuffer.allocateDirect(size + 10);
View Full Code Here


    }
    static void test3() {
        SelectorProvider sp = SelectorProvider.provider();
        for (int i=0; i<11000; i++) {
            try {
                Pipe p = sp.openPipe();
            } catch (Exception e) {
                // Presumably "Too many open files"
            }
        }
    }
View Full Code Here

        // Load necessary classes ahead of time
        DatagramChannel dc = DatagramChannel.open();
        Exception se = new SocketException();
        SelectorProvider sp = SelectorProvider.provider();
        Pipe p = sp.openPipe();
        ServerSocketChannel ssc = ServerSocketChannel.open();

        test1();
        test2();
        test3();
View Full Code Here

    private static Random generator = new Random();

    public static void main(String[] args) throws Exception {
        for (int x=0; x<100; x++) {
            SelectorProvider sp = SelectorProvider.provider();
            Pipe p = sp.openPipe();
            Pipe.SinkChannel sink = p.sink();
            Pipe.SourceChannel source = p.source();

            ByteBuffer outgoingdata = ByteBuffer.allocateDirect(10);
            byte[] someBytes = new byte[10];
View Full Code Here

* Testing PipeChannel
*/
public class EmptyRead {
    public static void main(String[] args) throws Exception {
        SelectorProvider sp = SelectorProvider.provider();
        Pipe p = sp.openPipe();
        Pipe.SinkChannel sink = p.sink();
        Pipe.SourceChannel source = p.source();

        byte[] someBytes = new byte[0];
        ByteBuffer outgoingdata = ByteBuffer.wrap(someBytes);
View Full Code Here

    public static void main(String[] args) throws Exception {

        SelectorProvider sp = SelectorProvider.provider();
        Selector selector = Selector.open();
        Pipe p = sp.openPipe();
        Pipe.SinkChannel sink = p.sink();
        Pipe.SourceChannel source = p.source();

        source.configureBlocking(false);
        sink.configureBlocking(false);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.