/** * Whether the flags specify "readable", either read/write or read-only. * * @return true if readable, false otherwise */ public boolean isReadable() { return ((flags & RDWR) != 0) || isReadOnly(); }
/** * Whether the flags specify "readable", either read/write or read-only. * * @return true if readable, false otherwise */ public boolean isReadable() { return ((flags & RDWR) != 0) || isReadOnly(); }
/** * Whether the flags specify "readable", either read/write or read-only. * * @return true if readable, false otherwise */ public boolean isReadable() { return ((flags & RDWR) != 0) || isReadOnly(); }
/** * Whether the flags specify "readable", either read/write or read-only. * * @return true if readable, false otherwise */ public boolean isReadable() { return ((flags & RDWR) != 0) || isReadOnly(); }
private void setupModes() { ptr.closedWrite = false; ptr.closedRead = false; if (ptr.modes.isReadOnly()) ptr.closedWrite = true; if (!ptr.modes.isReadable()) ptr.closedRead = true; }
private void setupModes() { ptr.closedWrite = false; ptr.closedRead = false; if (ptr.modes.isReadOnly()) ptr.closedWrite = true; if (!ptr.modes.isReadable()) ptr.closedRead = true; }
/** * Construct a new ModeFlags object with the specified flags * * @param flags The flags to use for this object * @throws org.jruby.util.io.InvalidValueException If the modes are invalid */ public ModeFlags(long flags) throws InvalidValueException { // TODO: Ruby does not seem to care about invalid numeric mode values // I am not sure if ruby overflows here also... this.flags = (int)flags; if (isReadOnly() && ((flags & APPEND) != 0)) { // MRI 1.8 behavior: this combination of flags is not allowed throw new InvalidValueException(); } }
/** * Construct a new ModeFlags object with the specified flags * * @param flags The flags to use for this object * @throws org.jruby.util.io.InvalidValueException If the modes are invalid */ public ModeFlags(long flags) throws InvalidValueException { // TODO: Ruby does not seem to care about invalid numeric mode values // I am not sure if ruby overflows here also... this.flags = (int)flags; if (isReadOnly() && ((flags & APPEND) != 0)) { // MRI 1.8 behavior: this combination of flags is not allowed throw new InvalidValueException(); } }
@Override public String toString() { StringBuilder buf = new StringBuilder("ModeFlags(" + flags + "): "); if (isAppendable()) buf.append("APPENDABLE "); if (isBinary()) buf.append("BINARY "); if (isCreate()) buf.append("CREATE "); if (isExclusive()) buf.append("EXCLUSIVE "); if (isReadOnly()) buf.append("READONLY "); if (isText()) buf.append("TEXT "); if (isTruncate()) buf.append("TRUNCATE "); if (isWritable()) { if (isReadable()) { buf.append("RDWR"); } else { buf.append("WRITABLE "); } } return buf.toString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append("ModeFlags(").append(flags).append("): "); if (isAppendable()) buf.append("APPENDABLE "); if (isBinary()) buf.append("BINARY "); if (isCreate()) buf.append("CREATE "); if (isExclusive()) buf.append("EXCLUSIVE "); if (isReadOnly()) buf.append("READONLY "); if (isText()) buf.append("TEXT "); if (isTemporary()) buf.append("TMPFILE "); if (isTruncate()) buf.append("TRUNCATE "); if (isWritable()) { if (isReadable()) { buf.append("RDWR"); } else { buf.append("WRITABLE "); } } return buf.toString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append("ModeFlags(").append(flags).append("): "); if (isAppendable()) buf.append("APPENDABLE "); if (isBinary()) buf.append("BINARY "); if (isCreate()) buf.append("CREATE "); if (isExclusive()) buf.append("EXCLUSIVE "); if (isReadOnly()) buf.append("READONLY "); if (isText()) buf.append("TEXT "); if (isTemporary()) buf.append("TMPFILE "); if (isTruncate()) buf.append("TRUNCATE "); if (isWritable()) { if (isReadable()) { buf.append("RDWR"); } else { buf.append("WRITABLE "); } } return buf.toString(); }
@Override public String toString() { StringBuilder buf = new StringBuilder("ModeFlags(" + flags + "): "); if (isAppendable()) buf.append("APPENDABLE "); if (isBinary()) buf.append("BINARY "); if (isCreate()) buf.append("CREATE "); if (isExclusive()) buf.append("EXCLUSIVE "); if (isReadOnly()) buf.append("READONLY "); if (isText()) buf.append("TEXT "); if (isTruncate()) buf.append("TRUNCATE "); if (isWritable()) { if (isReadable()) { buf.append("RDWR"); } else { buf.append("WRITABLE "); } } return buf.toString(); }