Interface RandomAccessToFile

All Known Implementing Classes:
RandomAccessFilePaged, RandomAccessFileRAF

public interface RandomAccessToFile
random access file abstraction
Author:
juergen
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkFile(long offset, int len)
    check file contents
    void
    close file
    void
     
    void
    flush file
    long
    get the current position of the file
    long
    Get the file length
    void
    read(byte[] bytes)
    Reads a byte array from current position.
    void
    read(byte[] bytes, int offset, int len)
     
    byte
    Reads a byte from current position.
    int
    Reads an int at current position.
    long
    Reads a long at current position.
    void
    seek(long position)
    Positions to an address
    void
    write(byte[] bytes)
    Writes a byte array to current position.
    void
    write(byte[] bytes, int start, int len)
    Writes len bytes from byte array from start position to current position.
    void
    writeByte(int b)
    Reads a byte current position
    void
    writeInt(int value)
    Writes an int to current position.
    void
    writeLong(long value)
    Writes a long to current position.
  • Method Details

    • seek

      void seek(long position) throws IOException
      Positions to an address
      Parameters:
      position -
      Throws:
      IOException
    • read

      void read(byte[] bytes) throws IOException
      Reads a byte array from current position. Creates an exception if byte array crosses a page border
      Parameters:
      bytes -
      Throws:
      IOException
    • readByte

      byte readByte() throws IOException
      Reads a byte from current position.
      Parameters:
      b -
      Throws:
      IOException
    • writeByte

      void writeByte(int b) throws IOException
      Reads a byte current position
      Parameters:
      b -
      Throws:
      IOException
    • write

      void write(byte[] bytes) throws IOException
      Writes a byte array to current position. Creates an exception if byte array crosses a page border
      Parameters:
      bytes -
      Throws:
      IOException
    • write

      void write(byte[] bytes, int start, int len) throws IOException
      Writes len bytes from byte array from start position to current position. Creates an exception if byte array crosses a page border
      Parameters:
      bytes -
      Throws:
      IOException
    • readInt

      int readInt() throws IOException
      Reads an int at current position. Creates an exception if byte array crosses a page border
      Throws:
      IOException
    • writeInt

      void writeInt(int value) throws IOException
      Writes an int to current position. Creates an exception if byte array crosses a page border
      Parameters:
      value -
      Throws:
      IOException
    • close

      void close() throws IOException
      close file
      Throws:
      IOException
    • flush

      void flush() throws IOException
      flush file
      Throws:
      IOException
    • readLong

      long readLong() throws IOException
      Reads a long at current position. Creates an exception if byte array crosses a page border
      Throws:
      IOException
    • writeLong

      void writeLong(long value) throws IOException
      Writes a long to current position. Creates an exception if byte array crosses a page border
      Throws:
      IOException
    • length

      long length() throws IOException
      Get the file length
      Throws:
      IOException
    • read

      void read(byte[] bytes, int offset, int len) throws IOException
      Parameters:
      bytes -
      offset -
      len -
      Throws:
      IOException
    • delete

      void delete() throws IOException
      Throws:
      IOException
    • getFilePointer

      long getFilePointer() throws IOException
      get the current position of the file
      Returns:
      Throws:
      IOException
    • checkFile

      boolean checkFile(long offset, int len) throws IOException
      check file contents
      Parameters:
      offset -
      len -
      Returns:
      Throws:
      IOException