public class ModeFlags
extends java.lang.Object
implements java.lang.Cloneable
org.jruby.io.util.ChannelDescriptor
,
org.jruby.io.util.Stream
,
org.jruby.io.util.OpenFile
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ModeFlags()
Construct a new ModeFlags object with the default read-only flag.
|
ModeFlags(long flags)
Construct a new ModeFlags object with the specified flags
|
Modifier and Type | Method and Description |
---|---|
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() |
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
public ModeFlags()
public ModeFlags(long flags) throws InvalidValueException
flags
- The flags to use for this objectInvalidValueException
- If the modes are invalidpublic 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 onepublic java.lang.String toString()
toString
in class java.lang.Object
public int getOpenFileFlags()
Copyright © 2002-2009 JRuby Team. All Rights Reserved.