Package java.nio.channels

Examples of java.nio.channels.Channel


                         (socketChannel instanceof SocketChannel) ? asSocket().getKeepAlive() : false
                         );
    }

    private IRubyObject getLinger(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();

        int linger = 0;
        if (socketChannel instanceof SocketChannel) {
            linger = asSocket().getSoLinger();
            if (linger < 0) {
View Full Code Here


        return number(runtime, linger);
    }

    private IRubyObject getOOBInline(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();
        return trueFalse(runtime,
                         (socketChannel instanceof SocketChannel) ? asSocket().getOOBInline() : false
                         );
    }
View Full Code Here

                         (socketChannel instanceof SocketChannel) ? asSocket().getOOBInline() : false
                         );
    }

    private IRubyObject getRcvBuf(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();
        return number(runtime,
                      (socketChannel instanceof SocketChannel) ? asSocket().getReceiveBufferSize() :
                      ((socketChannel instanceof ServerSocketChannel) ? asServerSocket().getReceiveBufferSize() :
                       asDatagramSocket().getReceiveBufferSize())
                      );
View Full Code Here

                       asDatagramSocket().getReceiveBufferSize())
                      );
    }

    private IRubyObject getSndBuf(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();
        return number(runtime,
                      (socketChannel instanceof SocketChannel) ? asSocket().getSendBufferSize() :
                      ((socketChannel instanceof DatagramChannel) ? asDatagramSocket().getSendBufferSize() : 0)
                      );
    }
View Full Code Here

                      ((socketChannel instanceof DatagramChannel) ? asDatagramSocket().getSendBufferSize() : 0)
                      );
    }

    private IRubyObject getReuseAddr(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();

        boolean reuse = false;
        if (socketChannel instanceof ServerSocketChannel) {
            reuse = asServerSocket().getReuseAddress();
        } else if (socketChannel instanceof SocketChannel) {
View Full Code Here

        return trueFalse(runtime, reuse);
    }

    private IRubyObject getTimeout(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();
        return number(runtime,
                      (socketChannel instanceof SocketChannel) ? asSocket().getSoTimeout() :
                      ((socketChannel instanceof ServerSocketChannel) ? asServerSocket().getSoTimeout() :
                       ((socketChannel instanceof DatagramChannel) ? asDatagramSocket().getSoTimeout() : 0))
                      );
View Full Code Here

        } else {
            return getSoTypeDefault();
        }
    }
    private IRubyObject getSoType(Ruby runtime) throws IOException, BadDescriptorException {
        Channel socketChannel = getOpenChannel();
        return number(runtime, getChannelSoType(socketChannel));
    }
View Full Code Here

            throw context.runtime.newErrnoEBADFError();
        }
    }

    private IRubyObject shutdownInternal(ThreadContext context, int how) throws BadDescriptorException {
        Channel socketChannel;
        switch (how) {
        case 0:
            socketChannel = getOpenChannel();
            try {
                if (socketChannel instanceof SocketChannel ||
View Full Code Here

            task.wakeup();
        }
    }
    private volatile BlockingIO.Condition blockingIO = null;
    public boolean waitForIO(ThreadContext context, RubyIO io, int ops) {
        Channel channel = io.getChannel();

        if (!(channel instanceof SelectableChannel)) {
            return true;
        }
        try {
View Full Code Here

    public ByteChannel channel() {
        return this.channel;
    }
   
    public SocketAddress getLocalAddress() {
        Channel channel = this.key.channel();
        if (channel instanceof SocketChannel) {
            return ((SocketChannel)channel).socket().getLocalSocketAddress();
        } else {
            return null;
        }
View Full Code Here

TOP

Related Classes of java.nio.channels.Channel

Copyright © 2018 www.massapicom. 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.