Package org.apache.commons.io
Enum RandomAccessFileMode
- java.lang.Object
-
- java.lang.Enum<RandomAccessFileMode>
-
- org.apache.commons.io.RandomAccessFileMode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<RandomAccessFileMode>
public enum RandomAccessFileMode extends java.lang.Enum<RandomAccessFileMode>
Access modes and factory methods forRandomAccessFile
.- Since:
- 2.12.0
-
-
Enum Constant Summary
Enum Constants Enum Constant Description READ_ONLY
Mode"r"
opens for reading only.READ_WRITE
Mode"rw"
opens for reading and writing.READ_WRITE_SYNC_ALL
Mode"rws"
opens for reading and writing, as with"rw"
, and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.READ_WRITE_SYNC_CONTENT
Mode"rwd"
open for reading and writing, as with"rw"
, and also require that every update to the file's content be written synchronously to the underlying storage device.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.RandomAccessFile
create(java.io.File file)
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.java.io.RandomAccessFile
create(java.lang.String file)
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.java.io.RandomAccessFile
create(java.nio.file.Path file)
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.java.lang.String
toString()
static RandomAccessFileMode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static RandomAccessFileMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
READ_ONLY
public static final RandomAccessFileMode READ_ONLY
Mode"r"
opens for reading only.
-
READ_WRITE
public static final RandomAccessFileMode READ_WRITE
Mode"rw"
opens for reading and writing.
-
READ_WRITE_SYNC_ALL
public static final RandomAccessFileMode READ_WRITE_SYNC_ALL
Mode"rws"
opens for reading and writing, as with"rw"
, and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.
-
READ_WRITE_SYNC_CONTENT
public static final RandomAccessFileMode READ_WRITE_SYNC_CONTENT
Mode"rwd"
open for reading and writing, as with"rw"
, and also require that every update to the file's content be written synchronously to the underlying storage device.
-
-
Method Detail
-
values
public static RandomAccessFileMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RandomAccessFileMode c : RandomAccessFileMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RandomAccessFileMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
create
public java.io.RandomAccessFile create(java.io.File file) throws java.io.FileNotFoundException
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.- Parameters:
file
- the file object- Returns:
- a random access file stream
- Throws:
java.io.FileNotFoundException
- SeeRandomAccessFile(File, String)
.
-
create
public java.io.RandomAccessFile create(java.nio.file.Path file) throws java.io.FileNotFoundException
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.- Parameters:
file
- the file object- Returns:
- a random access file stream
- Throws:
java.io.FileNotFoundException
- SeeRandomAccessFile(File, String)
.
-
create
public java.io.RandomAccessFile create(java.lang.String file) throws java.io.FileNotFoundException
Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument.- Parameters:
file
- the file object- Returns:
- a random access file stream
- Throws:
java.io.FileNotFoundException
- SeeRandomAccessFile(File, String)
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<RandomAccessFileMode>
-
-