Package jnr.enxio.channels

Examples of jnr.enxio.channels.NativeDeviceChannel


        if (!FilenoUtil.isFake(fileno)) {
            // try using existing ChannelFD, then fall back on creating a new one
            fd = runtime.getFilenoUtil().getWrapperFromFileno(fileno);

            if (fd == null) {
                fd = new ChannelFD(new NativeDeviceChannel(fileno), runtime.getPosix(), runtime.getFilenoUtil());
            }
        } else {
            ChannelFD descriptor = runtime.getFilenoUtil().getWrapperFromFileno(fileno);

            if (descriptor == null) throw runtime.newErrnoEBADFError();
View Full Code Here


                        throw new ResourceException.IOError(new IOException("unhandled errno: " + errno));

                }
            }
            posix.fcntlInt(fd, Fcntl.F_SETFD, posix.fcntl(fd, Fcntl.F_GETFD) | FcntlLibrary.FD_CLOEXEC);
            return new NativeDeviceChannel(fd);
        }

        if (flags.isCreate()) {
            boolean fileCreated;
            try {
View Full Code Here

    public ChannelFD dup() {
        if (realFileno != -1) {
            // real file descriptors, so we can dup directly
            // TODO: investigate how badly this might damage JVM streams (prediction: not badly)
            return new ChannelFD(new NativeDeviceChannel(posix.dup(realFileno)), posix, filenoUtil);
        }

        // TODO: not sure how well this combines native and non-native streams
        // simulate dup by copying our channel into a new ChannelFD and incrementing ref count
        Channel ch = this.ch;
View Full Code Here

    }

    private static Channel prepareStdioChannel(Ruby runtime, STDIO stdio, Object stream) {
        if (runtime.getPosix().isNative() && stdio.isJVMDefault(stream)) {
            // use real native channel for stdio
            return new NativeDeviceChannel(stdio.fileno());
        } else {
            switch (stdio) {
                case IN:
                    return Channels.newChannel((InputStream)stream);
                case OUT:
View Full Code Here

TOP

Related Classes of jnr.enxio.channels.NativeDeviceChannel

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.