Class FilePathReorderWrites


public class FilePathReorderWrites extends FilePathWrapper
An unstable file system. It is used to simulate file system problems (for example out of disk space).
  • Constructor Details

    • FilePathReorderWrites

      public FilePathReorderWrites()
  • Method Details

    • register

      public static FilePathReorderWrites register()
      Register the file system.
      Returns:
      the instance
    • setPowerOffCountdown

      public void setPowerOffCountdown(int count, int seed)
      Set the number of write operations before a simulated power failure, and the random seed (for partial writes).
      Parameters:
      count - the number of write operations (0 to never fail, Integer.MAX_VALUE to count the operations)
      seed - the new seed
    • getPowerOffCountdown

      public int getPowerOffCountdown()
    • setPartialWrites

      public static void setPartialWrites(boolean b)
      Whether partial writes are possible (writing only part of the data).
      Parameters:
      b - true to enable
    • open

      public FileChannel open(String mode) throws IOException
      Description copied from class: FilePath
      Open a random access file object.
      Overrides:
      open in class FilePathWrapper
      Parameters:
      mode - the access mode. Supported are r, rw, rws, rwd
      Returns:
      the file object
      Throws:
      IOException - If an I/O error occurs
    • getScheme

      public String getScheme()
      Description copied from class: FilePath
      Get the scheme (prefix) for this file provider. This is similar to java.nio.file.spi.FileSystemProvider.getScheme.
      Specified by:
      getScheme in class FilePath
      Returns:
      the scheme
    • getMaxAge

      public long getMaxAge()
    • delete

      public void delete()
      Description copied from class: FilePath
      Delete a file or directory if it exists. Directories may only be deleted if they are empty.
      Overrides:
      delete in class FilePathWrapper