All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
RAIFile

public interface RandomAccessInterface extends Closeable
Interface for random access file operations. Provides methods for reading, writing, and seeking within files.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    boolean
    Is the file writable? (I2P) Only valid if the File constructor was used, not the RAF constructor
    void
    Closes the file.
    long
    Returns the current position of the file pointer.
    long
    Returns the size of the file in bytes.
    int
    Reads one byte and advances the file pointer past it.
    int
    read(byte[] b)
    Reads bytes into b and advances the file pointer past them.
    int
    read(byte[] b, int off, int len)
    Reads bytes into b at off and advances the file pointer past them.
    boolean
    Reads a single byte, reporting it as a boolean.
    byte
    Reads one byte as a signed value.
    char
    Reads two bytes as a big-endian char.
    double
    Reads eight bytes as a big-endian double.
    float
    Reads four bytes as a big-endian float.
    void
    readFully(byte[] b)
    Fills b, failing unless every byte of it is read.
    void
    readFully(byte[] b, int off, int len)
    Fills len bytes of b at off, failing unless all are read.
    int
    Reads four bytes as a big-endian int.
    Reads bytes up to a line terminator, discarding the terminator.
    long
    Reads eight bytes as a big-endian long.
    short
    Reads two bytes as a big-endian short.
    int
    Reads one byte, widening it to an unsigned int.
    int
    Read a 4-byte big-endian unsigned int.
    int
    Reads two bytes, widening them to an unsigned int.
    Reads a length-prefixed UTF-8 string.
    void
    seek(long pos)
    Moves the file pointer to an absolute offset.
    void
    setLength(long newLength)
    Truncates or extends the file to the given size.
    int
    skipBytes(int n)
    Advances the file pointer without reading the bytes skipped.
    void
    write(byte[] b)
    Writes every byte of b.
    void
    write(byte[] b, int off, int len)
    Writes len bytes from b, starting at off.
    void
    write(int b)
    Writes the low eight bits of b.
    void
    writeBoolean(boolean v)
    Writes a single byte holding 1 for true, 0 for false.
    void
    writeByte(int v)
    Writes the low eight bits of v.
    void
    Writes the low byte of each character of s.
    void
    writeChar(int v)
    Writes the low sixteen bits of v as a big-endian char.
    void
    Writes each character of s as two big-endian bytes.
    void
    writeDouble(double v)
    Writes v as eight big-endian bytes.
    void
    writeFloat(float v)
    Writes v as four big-endian bytes.
    void
    writeInt(int v)
    Writes v as four big-endian bytes.
    void
    writeLong(long v)
    Writes v as eight big-endian bytes.
    void
    writeShort(int v)
    Writes the low sixteen bits of v as a big-endian short.
    void
    Writes str as a length-prefixed UTF-8 string.