All Implemented Interfaces:
Closeable, DataInput, DataOutput, AutoCloseable

  • Constructor Summary

    Constructors

    Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.

    Creates a random access file stream to read from, and optionally to write to, a file with the specified pathname.

  • Method Summary

    void

    close()

    Closes this random access file stream and releases any system resources associated with the stream.

    Returns the unique FileChannel object associated with this file.

    getFD()

    Returns the opaque file descriptor object associated with this stream.

    long

    Returns the current offset in this file.

    long

    length()

    Returns the length of this file.

    int

    read()

    Reads a byte of data from this file.

    int

    read(byte[] b)

    Reads up to b.length bytes of data from this file into an array of bytes.

    int

    read(byte[] b, int off, int len)

    Reads up to len bytes of data from this file into an array of bytes.

    final boolean

    Reads a boolean from this file.

    final byte

    readByte()

    Reads a signed eight-bit value from this file.

    final char

    readChar()

    Reads a character from this file.

    final double

    Reads a double from this file.

    final float

    readFloat()

    Reads a float from this file.

    final void

    readFully(byte[] b)

    Reads b.length bytes from this file into the byte array, starting at the current file pointer.

    final void

    readFully(byte[] b, int off, int len)

    Reads exactly len bytes from this file into the byte array, starting at the current file pointer.

    final int

    readInt()

    Reads a signed 32-bit integer from this file.

    readLine()

    Reads the next line of text from this file.

    final long

    readLong()

    Reads a signed 64-bit integer from this file.

    final short

    readShort()

    Reads a signed 16-bit number from this file.

    final int

    Reads an unsigned eight-bit number from this file.

    final int

    Reads an unsigned 16-bit number from this file.

    readUTF()

    Reads in a string from this file.

    void

    seek(long pos)

    Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.

    void

    setLength(long newLength)

    Sets the length of this file.

    int

    skipBytes(int n)

    Attempts to skip over n bytes of input discarding the skipped bytes.

    void

    write(byte[] b)

    Writes b.length bytes from the specified byte array to this file, starting at the current file pointer.

    void

    write(byte[] b, int off, int len)

    Writes len bytes from the specified byte array starting at offset off to this file.

    void

    write(int b)

    Writes the specified byte to this file.

    final void

    writeBoolean(boolean v)

    Writes a boolean to the file as a one-byte value.

    final void

    writeByte(int v)

    Writes a byte to the file as a one-byte value.

    final void

    Writes the string to the file as a sequence of bytes.

    final void

    writeChar(int v)

    Writes a char to the file as a two-byte value, high byte first.

    final void

    Writes a string to the file as a sequence of characters.

    final void

    writeDouble(double v)

    Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an eight-byte quantity, high byte first.

    final void

    writeFloat(float v)

    Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a four-byte quantity, high byte first.

    final void

    writeInt(int v)

    Writes an int to the file as four bytes, high byte first.

    final void

    writeLong(long v)

    Writes a long to the file as eight bytes, high byte first.

    final void

    writeShort(int v)

    Writes a short to the file as two bytes, high byte first.

    final void

    Writes a string to the file using modified UTF-8 encoding in a machine-independent manner.

    Methods declared in class Object

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

    Creates and returns a copy of this object.

    boolean

    Indicates whether some other object is "equal to" this one.

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    int

    Returns a hash code value for this object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    Returns a string representation of the object.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

  • Constructor Details

    • RandomAccessFile

    • RandomAccessFile

  • Method Details

    • getFD

    • getChannel

    • read

    • read

    • read

    • readFully

    • readFully

    • skipBytes

    • write

    • write

    • write

    • getFilePointer

    • seek

    • length

    • setLength

    • close

    • readBoolean

    • readByte

    • readUnsignedByte

    • readShort

    • readUnsignedShort

    • readChar

    • readInt

    • readLong

    • readFloat

    • readDouble

    • readLine

    • readUTF

    • writeBoolean

    • writeByte

    • writeShort

    • writeChar

    • writeInt

    • writeLong

    • writeFloat

    • writeDouble

    • writeBytes

    • writeChars

    • writeUTF