@JRubyMethod(name = "chardev?") public IRubyObject chardev_p() { return getRuntime().newBoolean(stat.isCharDev()); }
@JRubyMethod(name = "chardev?") public IRubyObject chardev_p() { return getRuntime().newBoolean(stat.isCharDev()); }
@JRubyMethod(name = "chardev?") public IRubyObject chardev_p() { checkInitialized(); return getRuntime().newBoolean(stat.isCharDev()); }
@JRubyMethod(name = "chardev?") public IRubyObject chardev_p() { checkInitialized(); return getRuntime().newBoolean(stat.isCharDev()); }
@JRubyMethod(name = "chardev?", required = 1, module = true) public static IRubyObject chardev_p(IRubyObject recv, IRubyObject filename) { FileStat stat = fileResource(filename).stat(); return recv.getRuntime().newBoolean(stat != null && stat.isCharDev()); }
@JRubyMethod(name = "chardev?", required = 1, module = true) public static IRubyObject chardev_p(IRubyObject recv, IRubyObject filename) { FileStat stat = fileResource(filename).stat(); return recv.getRuntime().newBoolean(stat != null && stat.isCharDev()); }
@JRubyMethod(name = "chardev?", required = 1, module = true) public static IRubyObject chardev_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); FileResource file = fileResource(filename); return runtime.newBoolean(file.exists() && file.stat(runtime.getPosix()).isCharDev()); }
@JRubyMethod(name = "chardev?", required = 1, module = true) public static IRubyObject chardev_p(IRubyObject recv, IRubyObject filename) { Ruby runtime = recv.getRuntime(); JRubyFile file = file(filename); return runtime.newBoolean(file.exists() && runtime.getPosix().stat(file.getAbsolutePath()).isCharDev()); }
public FileDescriptorIO(Ruby runtime, IRubyObject fd) { super(runtime, runtime.getModule("FFI").getClass(CLASS_NAME)); MakeOpenFile(); ModeFlags modes = newModeFlags(runtime, ModeFlags.RDWR); int fileno = RubyNumeric.fix2int(fd); FileStat stat = runtime.getPosix().fstat(fileno); ByteChannel channel; if (stat.isSocket()) { channel = new jnr.enxio.channels.NativeSocketChannel(fileno); } else if (stat.isBlockDev() || stat.isCharDev()) { channel = new jnr.enxio.channels.NativeDeviceChannel(fileno); } else { channel = new FileDescriptorByteChannel(runtime, fileno); } // openFile.setMainStream(ChannelStream.open(getRuntime(), new ChannelDescriptor(channel, modes, FileDescriptorHelper.wrap(fileno)))); openFile.setChannel(channel); openFile.setMode(modes.getOpenFileFlags()); openFile.setMode(modes.getOpenFileFlags()); openFile.setSync(true); }
public FileDescriptorIO(Ruby runtime, IRubyObject fd) { super(runtime, runtime.getModule("FFI").getClass(CLASS_NAME)); MakeOpenFile(); ModeFlags modes = newModeFlags(runtime, ModeFlags.RDWR); int fileno = RubyNumeric.fix2int(fd); FileStat stat = runtime.getPosix().fstat(fileno); ByteChannel channel; if (stat.isSocket()) { channel = new jnr.enxio.channels.NativeSocketChannel(fileno); } else if (stat.isBlockDev() || stat.isCharDev()) { channel = new jnr.enxio.channels.NativeDeviceChannel(fileno); } else { channel = new FileDescriptorByteChannel(runtime, fileno); } // openFile.setMainStream(ChannelStream.open(getRuntime(), new ChannelDescriptor(channel, modes, FileDescriptorHelper.wrap(fileno)))); openFile.setChannel(channel); openFile.setMode(modes.getOpenFileFlags()); openFile.setMode(modes.getOpenFileFlags()); openFile.setSync(true); }
public FileDescriptorIO(Ruby runtime, IRubyObject fd) { super(runtime, runtime.getModule("FFI").getClass(CLASS_NAME)); MakeOpenFile(); ModeFlags modes; try { modes = newModeFlags(runtime, ModeFlags.RDWR); int fileno = RubyNumeric.fix2int(fd); jnr.posix.FileStat stat = runtime.getPosix().fstat(fileno); java.nio.channels.ByteChannel channel; if (stat.isSocket()) { channel = new jnr.enxio.channels.NativeSocketChannel(fileno); } else if (stat.isBlockDev() || stat.isCharDev()) { channel = new jnr.enxio.channels.NativeDeviceChannel(fileno); } else { channel = new FileDescriptorByteChannel(runtime, fileno); } openFile.setMainStream(ChannelStream.open(getRuntime(), new ChannelDescriptor(channel, modes, FileDescriptorHelper.wrap(fileno)))); openFile.setPipeStream(openFile.getMainStreamSafe()); openFile.setMode(modes.getOpenFileFlags()); openFile.getMainStreamSafe().setSync(true); } catch (BadDescriptorException e) { throw runtime.newErrnoEBADFError(); } }
public FileDescriptorIO(Ruby runtime, IRubyObject fd) { super(runtime, runtime.getModule("FFI").getClass(CLASS_NAME)); MakeOpenFile(); ModeFlags modes; try { modes = newModeFlags(runtime, ModeFlags.RDWR); int fileno = RubyNumeric.fix2int(fd); jnr.posix.FileStat stat = runtime.getPosix().fstat(fileno); java.nio.channels.ByteChannel channel; if (stat.isSocket()) { channel = new jnr.enxio.channels.NativeSocketChannel(fileno); } else if (stat.isBlockDev() || stat.isCharDev()) { channel = new jnr.enxio.channels.NativeDeviceChannel(fileno); } else { channel = new FileDescriptorByteChannel(runtime, fileno); } openFile.setMainStream(ChannelStream.open(getRuntime(), new ChannelDescriptor(channel, modes, FileDescriptorHelper.wrap(fileno)))); openFile.setPipeStream(openFile.getMainStreamSafe()); openFile.setMode(modes.getOpenFileFlags()); openFile.getMainStreamSafe().setSync(true); } catch (BadDescriptorException e) { throw runtime.newErrnoEBADFError(); } }