Package org.apache.commons.io

# Class IORandomAccessFile

java.lang.Object
java.io.RandomAccessFile
org.apache.commons.io.IORandomAccessFile

All Implemented Interfaces:
  `Closeable`, `DataInput`, `DataOutput`, `AutoCloseable`

public final class IORandomAccessFile extends RandomAccessFile
Extends `RandomAccessFile` to provide access to the `File` and `mode` passed on construction.

Since:
  2.18.0
See Also:
  - `RandomAccessFile`
  - `RandomAccessFileMode`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IORandomAccessFile(File file, String mode)`
  Constructs a new instance by calling `RandomAccessFile(File, String)`.
  `IORandomAccessFile(String name, String mode)`
  Constructs a new instance by calling `RandomAccessFile(String, String)`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `File`
  `getFile()`
  Gets the file passed to `IORandomAccessFile(File, String)`.
  `String`
  `getMode()`
  Gets the mode passed to `IORandomAccessFile(File, String)`.
  `String`
  `toString()`
  Returns the pathname string of this abstract pathname.

  ### Methods inherited from class java.io.RandomAccessFile

  `close, getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### IORandomAccessFile

    public IORandomAccessFile(File file, String mode) throws FileNotFoundException
    Constructs a new instance by calling `RandomAccessFile(File, String)`.
    Parameters:
      `file` - the file object
      `mode` - the access mode, as described in `RandomAccessFile(File, String)`.
    Throws:
      `FileNotFoundException` - Thrown by `RandomAccessFile(File, String)`.
    See Also:
      - `RandomAccessFile(File, String)`

  - ### IORandomAccessFile

    public IORandomAccessFile(String name, String mode) throws FileNotFoundException
    Constructs a new instance by calling `RandomAccessFile(String, String)`.
    Parameters:
      `name` - the file object
      `mode` - the access mode, as described in `RandomAccessFile(String, String)`.
    Throws:
      `FileNotFoundException` - Thrown by `RandomAccessFile(String, String)`.
    See Also:
      - `RandomAccessFile(String, String)`

- ## Method Details

  - ### getFile

    public File getFile()
    Gets the file passed to `IORandomAccessFile(File, String)`.
    Returns:
      the file passed to `IORandomAccessFile(File, String)`.

  - ### getMode

    public String getMode()
    Gets the mode passed to `IORandomAccessFile(File, String)`.
    Returns:
      the mode passed to `IORandomAccessFile(File, String)`.

  - ### toString

    public String toString()
    Returns the pathname string of this abstract pathname. This is just the string returned by the `File.toString()` method.
    Overrides:
      `toString` in class `Object`
    Returns:
      The string form of the File's abstract pathname.
    See Also:
      - `File.toString()`