public ChannelDescriptor getDescriptor() { return stream.getDescriptor(); }
public ChannelDescriptor getDescriptor() { return stream.getDescriptor(); }
public ChannelDescriptor getDescriptor() { return stream.getDescriptor(); }
public ChannelDescriptor getDescriptor() { return stream.getDescriptor(); }
private Channel getOpenChannel() throws BadDescriptorException { return getOpenFileChecked().getMainStreamSafe().getDescriptor().getChannel(); }
private Channel getOpenChannel() throws BadDescriptorException { return getOpenFileChecked().getMainStreamSafe().getDescriptor().getChannel(); }
private static Stream maybeWrapWithLineEndingWrapper(Stream stream, ModeFlags modes) { if (modes.isText() || // FIXME: Remove this one textmode is part of transcoding. (Platform.IS_WINDOWS && stream.getDescriptor().getChannel() instanceof SeekableByteChannel && !modes.isBinary())) { return new CRLFStreamWrapper(stream); } return stream; }
private static Stream maybeWrapWithLineEndingWrapper(Stream stream, ModeFlags modes) { if (modes.isText() || // FIXME: Remove this one textmode is part of transcoding. (Platform.IS_WINDOWS && stream.getDescriptor().getChannel() instanceof SeekableByteChannel && !modes.isBinary())) { return new CRLFStreamWrapper(stream); } return stream; }
private static Stream maybeWrapWithLineEndingWrapper(Stream stream, ModeFlags modes) { if (modes.isText() || // FIXME: Remove this one textmode is part of transcoding. (Platform.IS_WINDOWS && stream.getDescriptor().getChannel() instanceof FileChannel && !modes.isBinary())) { return new CRLFStreamWrapper(stream); } return stream; }
private static Stream maybeWrapWithLineEndingWrapper(Stream stream, ModeFlags modes) { if (modes.isText() || // FIXME: Remove this one textmode is part of transcoding. (Platform.IS_WINDOWS && stream.getDescriptor().getChannel() instanceof FileChannel && !modes.isBinary())) { return new CRLFStreamWrapper(stream); } return stream; }
@Override public String toString() { try { return "RubyFile(" + path + ", " + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")"; } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } }
@Override public String toString() { try { return "RubyIO(" + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")"; } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } }
@JRubyMethod(name = "fileno", alias = "to_i") public RubyFixnum fileno(ThreadContext context) { Ruby runtime = context.runtime; // map to external fileno try { return runtime.newFixnum(runtime.getFileno(getOpenFileChecked().getMainStreamSafe().getDescriptor())); } catch (BadDescriptorException e) { throw runtime.newErrnoEBADFError(); } }
@JRubyMethod(name = "fileno", alias = "to_i") public RubyFixnum fileno(ThreadContext context) { Ruby runtime = context.runtime; // map to external fileno try { return runtime.newFixnum(runtime.getFileno(getOpenFileChecked().getMainStreamSafe().getDescriptor())); } catch (BadDescriptorException e) { throw runtime.newErrnoEBADFError(); } }
@Override public String toString() { try { return "RubyFile(" + path + ", " + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")"; } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } }
@Override public String toString() { try { return "RubyIO(" + openFile.getMode() + ", " + getRuntime().getFileno(openFile.getMainStreamSafe().getDescriptor()) + ")"; } catch (BadDescriptorException e) { throw getRuntime().newErrnoEBADFError(); } }
@JRubyMethod public IRubyObject stat(ThreadContext context) { openFile.checkClosed(context.runtime); try { return context.runtime.newFileStat(getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } }
@JRubyMethod public IRubyObject stat(ThreadContext context) { openFile.checkClosed(context.runtime); try { return context.runtime.newFileStat(getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } }
@JRubyMethod(name = {"tty?", "isatty"}) public RubyBoolean tty_p(ThreadContext context) { try { return context.runtime.newBoolean( context.runtime.getPosix().isatty( getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor())); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } }
@JRubyMethod(name = {"tty?", "isatty"}) public RubyBoolean tty_p(ThreadContext context) { try { return context.runtime.newBoolean( context.runtime.getPosix().isatty( getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor())); } catch (BadDescriptorException e) { throw context.runtime.newErrnoEBADFError(); } }