Note
In MRI these are called oflags.
org.jruby.util.io.OpenFile
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ACCMODE
accmode flag, used to mask the read/write mode |
| public static final int | APPEND
append flag, to seek to the end of the file |
| public static final int | BINARY
binary flag, to ensure no encoding changes are made while writing (Windows only) |
| public static final int | CREAT
create flag, to specify non-existing file should be created |
| public static final int | EXCL
exclusive access flag, to require locking the target file |
| private final int | flags
the set of flags for this ModeFlags instance |
| public static final int | NONBLOCK
nonblock flag, to perform all operations non-blocking. |
| public static final OpenOption | NOSHARE_DELETE
try to access special mode flag, failover to default SHARE_DELETE otherwise |
| private OpenOption[] | openOptions
a cached array of |
| public static final int | RDONLY
read-only flag (default value if no other flags set) |
| public static final int | RDWR
read/write flag |
| public static final int | SHARE_DELETE
delete shared file flag for windows, otherwise zero |
| public static final int | TEXT
textmode flag, MRI has no equivalent but we use ModeFlags currently to also capture what are oflags. |
| public static final int | TMPFILE
tmpfile flag (Linux only) |
| public static final int | TRUNC
truncate flag, to truncate the target file to zero length |
| public static final int | WRONLY
write-only flag |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ModeFlags(long
The flags to use for this object flags)Construct a new ModeFlags object with the specified flags |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static ModeFlags | |
| public int | Returns: an int of flags appropriate for fcntlConvert the flags in this object to a set of flags appropriate for the fcntl. |
| public int | Returns: an int of the private flags variable.Return a value that, when passed to our constructor, would create a copy of this instance. |
| public static ModeFlags | Returns: the mode flagsthe channel to examine for capabilities channel)
Deprecated
Build a set of mode flags using the specified channel's actual capabilities. |
| public static int | |
| public static int | |
| public int | Returns: an int of flags appropriate for OpenFileConvert the flags in this object to a set of flags appropriate for the OpenFile structure and logic therein. |
| public static int | getOpenFileFlagsFor(int flags)
With the provided open flags parameter what fmode values should be set (fmode for us is represented by OpenFile). |
| public boolean | Returns: true if append, false otherwiseWhether the flags specify to append to existing files. |
| public boolean | Returns: true if binary mode, false otherwiseWhether the flags specify "binary" mode for reads and writes. |
| public boolean | Returns: true if nonexisting files should be created, false otherwiseWhether the flags specify to create nonexisting files. |
| public boolean | |
| public boolean | Returns: true if readable, false otherwiseWhether the flags specify "readable", either read/write or read-only. |
| public final boolean | |
| public boolean | Returns: true if read/write flag is set, false otherwiseWhether the flags specify "read/write". |
| public boolean | Returns: true if shared delete is allowed, false otherwiseWhether the flags specify to allow deleting shared files (Windows FILE_SHARE_DELETE). |
| public boolean | Returns: true if the object is a superset, false otherwiseThe ModeFlags object which should be a superset of this one 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. |
| public boolean | Returns: true if unnamed temporary mode, false otherwiseWhether the flags specify "unnamed temporary". |
| public boolean | Returns: true if text mode, false otherwiseWhether the flags specify "text" mode for reads and writes. |
| public boolean | Returns: true if truncate, false otherwiseWhether the flags specify to truncate the target file. |
| public boolean | Returns: true if writable, false otherwiseWhether the flags specify "writable", either read/write or write-only |
| public boolean | Returns: true if the write only flag is set, false otherwiseWhether the flags specify "write only". |
| public static int | Returns: the mode flagsthe channel to examine for capabilities channel)Build a set of mode flags using the specified channel's actual capabilities. |
| public String | Returns: A Java string suitable for opening files with RandomAccessFileProduce a Java IO mode string from the flags in this object. |
| public OpenOption[] | Returns: an array ofOpenOption that matches these mode flags.whether to include truncation in the options includeTruncate)Produce an array of |
| public String |
| ACCMODE | back to summary |
|---|---|
| public static final int ACCMODE accmode flag, used to mask the read/write mode | |
| APPEND | back to summary |
|---|---|
| public static final int APPEND append flag, to seek to the end of the file | |
| BINARY | back to summary |
|---|---|
| public static final int BINARY binary flag, to ensure no encoding changes are made while writing (Windows only) | |
| CREAT | back to summary |
|---|---|
| public static final int CREAT create flag, to specify non-existing file should be created | |
| EXCL | back to summary |
|---|---|
| public static final int EXCL exclusive access flag, to require locking the target file | |
| flags | back to summary |
|---|---|
| private final int flags the set of flags for this ModeFlags instance | |
| NONBLOCK | back to summary |
|---|---|
| public static final int NONBLOCK nonblock flag, to perform all operations non-blocking. Unused currently | |
| NOSHARE_DELETE | back to summary |
|---|---|
| public static final OpenOption NOSHARE_DELETE try to access special mode flag, failover to default SHARE_DELETE otherwise | |
| openOptions | back to summary |
|---|---|
| private OpenOption[] openOptions a cached array of | |
| RDONLY | back to summary |
|---|---|
| public static final int RDONLY read-only flag (default value if no other flags set) | |
| RDWR | back to summary |
|---|---|
| public static final int RDWR read/write flag | |
| SHARE_DELETE | back to summary |
|---|---|
| public static final int SHARE_DELETE delete shared file flag for windows, otherwise zero | |
| TEXT | back to summary |
|---|---|
| public static final int TEXT textmode flag, MRI has no equivalent but we use ModeFlags currently to also capture what are oflags. | |
| TMPFILE | back to summary |
|---|---|
| public static final int TMPFILE tmpfile flag (Linux only) | |
| TRUNC | back to summary |
|---|---|
| public static final int TRUNC truncate flag, to truncate the target file to zero length | |
| WRONLY | back to summary |
|---|---|
| public static final int WRONLY write-only flag | |
| ModeFlags | back to summary |
|---|---|
| public ModeFlags() Construct a new ModeFlags object with the default read-only flag. | |
| ModeFlags | back to summary |
|---|---|
| public ModeFlags(long flags) throws InvalidValueException Construct a new ModeFlags object with the specified flags
| |
| ModeFlags | back to summary |
|---|---|
| public ModeFlags(String flagString) throws InvalidValueException | |
| createModeFlags | back to summary |
|---|---|
| public static ModeFlags createModeFlags(int oflags) | |
| getFcntlFileFlags | back to summary |
|---|---|
| public int getFcntlFileFlags() Convert the flags in this object to a set of flags appropriate for the fcntl.
| |
| getFlags | back to summary |
|---|---|
| public int getFlags() Return a value that, when passed to our constructor, would create a copy of this instance.
| |
| getModesFromChannel | back to summary |
|---|---|
| public static ModeFlags getModesFromChannel(Channel channel)
Deprecated
Build a set of mode flags using the specified channel's actual capabilities. | |
| getOFlagsFromString | back to summary |
|---|---|
| public static int getOFlagsFromString(String modesString) throws InvalidValueException | |
| getOFlagsFromString | back to summary |
|---|---|
| public static int getOFlagsFromString(Ruby runtime, String modesString) | |
| getOpenFileFlags | back to summary |
|---|---|
| public int getOpenFileFlags() Convert the flags in this object to a set of flags appropriate for the OpenFile structure and logic therein.
| |
| getOpenFileFlagsFor | back to summary |
|---|---|
| public static int getOpenFileFlagsFor(int flags) With the provided open flags parameter what fmode values should be set (fmode for us is represented by OpenFile). | |
| isAppendable | back to summary |
|---|---|
| public boolean isAppendable() Whether the flags specify to append to existing files.
| |
| isBinary | back to summary |
|---|---|
| public boolean isBinary() Whether the flags specify "binary" mode for reads and writes.
| |
| isCreate | back to summary |
|---|---|
| public boolean isCreate() Whether the flags specify to create nonexisting files.
| |
| isExclusive | back to summary |
|---|---|
| public boolean isExclusive() Whether the flags specify exclusive access.
| |
| isReadable | back to summary |
|---|---|
| public boolean isReadable() Whether the flags specify "readable", either read/write or read-only.
| |
| isReadOnly | back to summary |
|---|---|
| public final boolean isReadOnly() Whether the flags specify"read only".
| |
| isReadWrite | back to summary |
|---|---|
| public boolean isReadWrite() Whether the flags specify "read/write".
| |
| isShareDelete | back to summary |
|---|---|
| public boolean isShareDelete() Whether the flags specify to allow deleting shared files (Windows FILE_SHARE_DELETE).
| |
| isSubsetOf | back to summary |
|---|---|
| public 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.
| |
| isTemporary | back to summary |
|---|---|
| public boolean isTemporary() Whether the flags specify "unnamed temporary".
| |
| isText | back to summary |
|---|---|
| public boolean isText() Whether the flags specify "text" mode for reads and writes.
| |
| isTruncate | back to summary |
|---|---|
| public boolean isTruncate() Whether the flags specify to truncate the target file.
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable() Whether the flags specify "writable", either read/write or write-only
| |
| isWriteOnly | back to summary |
|---|---|
| public boolean isWriteOnly() Whether the flags specify "write only".
| |
| oflagsFrom | back to summary |
|---|---|
| public static int oflagsFrom(POSIX posix, Channel channel) Build a set of mode flags using the specified channel's actual capabilities.
| |
| toJavaModeString | back to summary |
|---|---|
| public String toJavaModeString() Produce a Java IO mode string from the flags in this object.
| |
| toOpenOptions | back to summary |
|---|---|
| public OpenOption[] toOpenOptions(boolean includeAppend, boolean includeTruncate) Produce an array of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |