public class ModeFlags extends Object implements Cloneable
ChannelDescriptor, 
Stream, 
OpenFile| Modifier and Type | Field and Description | 
|---|---|
| static int | ACCMODEaccmode flag, used to mask the read/write mode | 
| static int | APPENDappend flag, to seek to the end of the file | 
| static int | BINARYbinary flag, to ensure no encoding changes are made while writing | 
| static int | CREATcreate flag, to specify non-existing file should be created | 
| static int | EXCLexclusive access flag, to require locking the target file | 
| static int | NONBLOCKnonblock flag, to perform all operations non-blocking. | 
| static int | RDONLYread-only flag (default value if no other flags set) | 
| static int | RDWRread/write flag | 
| static int | TEXTtextmode flag, MRI has no equivalent but we use ModeFlags currently
 to also capture what are oflags. | 
| static int | TRUNCtruncate flag, to truncate the target file to zero length | 
| static int | WRONLYwrite-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 | 
| ModeFlags(String flagString) | 
| Modifier and Type | Method and Description | 
|---|---|
| static ModeFlags | createModeFlags(int oflags) | 
| int | getFcntlFileFlags()Convert the flags in this object to a set of flags appropriate for the
 fcntl. | 
| int | getFlags()Return a value that, when passed to our constructor,
 would create a copy of this instance. | 
| static ModeFlags | getModesFromChannel(Channel channel)Deprecated.  | 
| static int | getOFlagsFromString(Ruby runtime,
                   String modesString) | 
| static int | getOFlagsFromString(String modesString) | 
| int | getOpenFileFlags()Convert the flags in this object to a set of flags appropriate for the
 OpenFile structure and logic therein. | 
| static int | getOpenFileFlagsFor(int flags)With the provided open flags parameter what fmode values should be
 set (fmode for us is represented by OpenFile). | 
| 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 | isText()Whether the flags specify "text" mode for reads and writes. | 
| boolean | isTruncate()Whether the flags specify to truncate the target file. | 
| boolean | isWritable()Whether the flags specify "writable", either read/write or write-only | 
| static int | oflagsFrom(jnr.posix.POSIX posix,
          Channel channel)Build a set of mode flags using the specified channel's actual capabilities. | 
| String | toJavaModeString()Produce a Java IO mode string from the flags in this object. | 
| 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 TEXT
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 ModeFlags(String flagString) throws InvalidValueException
InvalidValueExceptionpublic static int getOFlagsFromString(String modesString) throws InvalidValueException
InvalidValueExceptionpublic static int oflagsFrom(jnr.posix.POSIX posix,
             Channel channel)
channel - the channel to examine for capabilities@Deprecated public static ModeFlags getModesFromChannel(Channel channel)
channel - the channel to examine for capabilitiespublic String toJavaModeString()
public final boolean isReadOnly()
public boolean isReadable()
public boolean isBinary()
public boolean isText()
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 int getFlags()
public static int getOpenFileFlagsFor(int flags)
public int getOpenFileFlags()
public int getFcntlFileFlags()
public static ModeFlags createModeFlags(int oflags)
Copyright © 2001-2015 JRuby. All Rights Reserved.