Enum RandomAccessFileMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<RandomAccessFileMode>

    public enum RandomAccessFileMode
    extends java.lang.Enum<RandomAccessFileMode>
    Access modes and factory methods for RandomAccessFile.
    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 the File 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 the File 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 the File 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.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • 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 name
        java.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 the File argument.
        Parameters:
        file - the file object
        Returns:
        a random access file stream
        Throws:
        java.io.FileNotFoundException - See RandomAccessFile(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 the File argument.
        Parameters:
        file - the file object
        Returns:
        a random access file stream
        Throws:
        java.io.FileNotFoundException - See RandomAccessFile(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 the File argument.
        Parameters:
        file - the file object
        Returns:
        a random access file stream
        Throws:
        java.io.FileNotFoundException - See RandomAccessFile(File, String).
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<RandomAccessFileMode>