Class FileAsList

All Implemented Interfaces:
Iterable, Collection, List, SequencedCollection, Commitable

public abstract class FileAsList extends AbstractList implements Commitable
FileAsList creates a writable List implementation backed by a random access file. There is a restriction on the record length that the string representation of that integer may not be longer than 4 bytes. This is because a fixed 4 byte leader is used to encode the record length in the file.
Author:
Matthew Pocock, Keith James, Greg Cox
  • Constructor Details

    • FileAsList

      public FileAsList(File mappedFile, int recordLength) throws IOException
      Creates a new FileAsList and corresponding backing file.
      Parameters:
      mappedFile - a File used to back the list. This file must not already exist.
      recordLength - an int byte record length.
      Throws:
      IOException - if an error occurs.
    • FileAsList

      public FileAsList(File mappedFile, boolean mutable) throws IOException
      Creates a new FileAsList instance from an existing backing file.
      Parameters:
      mappedFile - a File used to back the list. This file must already exist.
      mutable - true if this list should support edits, false otherwise
      Throws:
      IOException - if an error occurs.
  • Method Details