private void initChannelTypes() { assert realFileno != -1 || fakeFileno != -1 : "initialize filenos before initChannelTypes"; if (ch instanceof ReadableByteChannel) chRead = (ReadableByteChannel)ch; else chRead = null; if (ch instanceof WritableByteChannel) chWrite = (WritableByteChannel)ch; else chWrite = null; if (ch instanceof SeekableByteChannel) chSeek = (SeekableByteChannel)ch; else chSeek = null; if (ch instanceof SelectableChannel) chSelect = (SelectableChannel)ch; else chSelect = null; if (ch instanceof FileChannel) chFile = (FileChannel)ch; else chFile = null; if (ch instanceof SocketChannel) chSock = (SocketChannel)ch; else chSock = null; if (ch instanceof NativeSelectableChannel) chNative = (NativeSelectableChannel)ch; else chNative = null; if (chNative != null) { // we have an ENXIO channel, but need to know if it's a regular file to skip selection FileStat stat = posix.fstat(chNative.getFD()); if (stat.isFile()) { chSelect = null; isNativeFile = true; } } }
private void initChannelTypes() { assert realFileno != -1 || fakeFileno != -1 : "initialize filenos before initChannelTypes"; if (ch instanceof ReadableByteChannel) chRead = (ReadableByteChannel)ch; else chRead = null; if (ch instanceof WritableByteChannel) chWrite = (WritableByteChannel)ch; else chWrite = null; if (ch instanceof SeekableByteChannel) chSeek = (SeekableByteChannel)ch; else chSeek = null; if (ch instanceof SelectableChannel) chSelect = (SelectableChannel)ch; else chSelect = null; if (ch instanceof FileChannel) chFile = (FileChannel)ch; else chFile = null; if (ch instanceof SocketChannel) chSock = (SocketChannel)ch; else chSock = null; if (ch instanceof NativeSelectableChannel) chNative = (NativeSelectableChannel)ch; else chNative = null; if (chNative != null) { // we have an ENXIO channel, but need to know if it's a regular file to skip selection FileStat stat = posix.fstat(chNative.getFD()); if (stat.isFile()) { chSelect = null; isNativeFile = true; } } }
@JRubyMethod(name = "file?") public RubyBoolean file_p() { return getRuntime().newBoolean(stat.isFile()); }
@JRubyMethod(name = "file?") public RubyBoolean file_p() { return getRuntime().newBoolean(stat.isFile()); }
@JRubyMethod(name = "file?") public RubyBoolean file_p() { checkInitialized(); return getRuntime().newBoolean(stat.isFile()); }
@JRubyMethod(name = "file?") public RubyBoolean file_p() { checkInitialized(); return getRuntime().newBoolean(stat.isFile()); }