Class FilePathUnstable


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

      • FilePathUnstable

        public FilePathUnstable()
    • Method Detail

      • register

        public static FilePathUnstable register()
        Register the file system.
        Returns:
        the instance
      • setDiskFullCount

        public void setDiskFullCount​(int count,
                                     int seed)
        Set the number of write operations before the disk is full, 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
      • getDiskFullCount

        public int getDiskFullCount()
      • setPartialWrites

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

        public java.nio.channels.FileChannel open​(java.lang.String mode)
                                           throws java.io.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:
        java.io.IOException - If an I/O error occurs
      • getScheme

        public java.lang.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