|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.util.io.ModeFlags
public class ModeFlags
This file represents the POSIX-like mode flags an open channel (as in a ChannelDescriptor) can have. It provides the basic flags for read/write as well as flags for create, truncate, and others. In addition, it provides methods for querying specific flag settings and converting to two other formats: a Java mode string and an OpenFile mode int.
org.jruby.io.util.ChannelDescriptor
,
org.jruby.io.util.Stream
,
org.jruby.io.util.OpenFile
Field Summary | |
---|---|
static int |
ACCMODE
accmode flag, used to mask the read/write mode |
static int |
APPEND
append flag, to seek to the end of the file |
static int |
BINARY
binary flag, to ensure no encoding changes are made while writing |
static int |
CREAT
create flag, to specify non-existing file should be created |
static int |
EXCL
exclusive access flag, to require locking the target file |
static int |
NONBLOCK
nonblock flag, to perform all operations non-blocking. |
static int |
RDONLY
read-only flag (default value if no other flags set) |
static int |
RDWR
read/write flag |
static int |
TRUNC
truncate flag, to truncate the target file to zero length |
static int |
WRONLY
write-only flag |
Constructor Summary | |
---|---|
ModeFlags()
Construct a new ModeFlags object with the default read-only flag. |
|
ModeFlags(long flags)
Construct a new ModeFlags object with the specified flags |
Method Summary | |
---|---|
int |
getOpenFileFlags()
Convert the flags in this object to a set of flags appropriate for the OpenFile structure and logic therein. |
boolean |
isAppendable()
Whether the flags specify to append to existing files. |
boolean |
isBinary()
Whether the flags specify "binary" mode for reads and writes. |
boolean |
isCreate()
Whether the flags specify to create nonexisting files. |
boolean |
isExclusive()
Whether the flags specify exclusive access. |
boolean |
isReadable()
Whether the flags specify "readable", either read/write or read-only. |
boolean |
isReadOnly()
Whether the flags specify"read only". |
boolean |
isSubsetOf(ModeFlags superset)
Check whether the target set of flags is a superset of this one; used to ensure that a file is not re-opened with more privileges than it already had. |
boolean |
isTruncate()
Whether the flags specify to truncate the target file. |
boolean |
isWritable()
Whether the flags specify "writable", either read/write or write-only |
java.lang.String |
toJavaModeString()
Produce a Java IO mode string from the flags in this object. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RDONLY
public static final int WRONLY
public static final int RDWR
public static final int CREAT
public static final int EXCL
public static final int TRUNC
public static final int APPEND
public static final int NONBLOCK
public static final int BINARY
public static final int ACCMODE
Constructor Detail |
---|
public ModeFlags()
public ModeFlags(long flags) throws InvalidValueException
flags
- The flags to use for this object
InvalidValueException
- If the modes are invalidMethod Detail |
---|
public java.lang.String toJavaModeString()
public boolean isReadOnly()
public boolean isReadable()
public boolean isBinary()
public boolean isCreate()
public boolean isWritable()
public boolean isExclusive()
public boolean isAppendable()
public boolean isTruncate()
public boolean isSubsetOf(ModeFlags superset)
superset
- The ModeFlags object which should be a superset of this one
public java.lang.String toString()
toString
in class java.lang.Object
public int getOpenFileFlags()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |