FilePathUnstable

An unstable file system. It is used to simulate file system problems (for example out of disk space).

Methods
static FilePathUnstable register()
Register the file system.
static FilePathUnstable register()
Register the file system.
Returns:
the instance
boolean canWrite()
boolean canWrite()
void checkError()
Check if the simulated problem occurred.
void checkError() throws IOException
Check if the simulated problem occurred. This call will decrement the countdown.
Throws:
IOException - if the simulated power failure occurred
void createDirectory()
void createDirectory()
boolean createFile()
boolean createFile()
FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir)
FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException
void delete()
void delete()
boolean exists()
boolean exists()
int getDiskFullCount()
int getDiskFullCount()
String getName()
String getName()
FilePath getParent()
FilePath getParent()
boolean getPartialWrites()
boolean getPartialWrites()
ByteBuffer getRandomSubset(ByteBuffer src)
Get a buffer with a subset (the head) of the data of the source buffer.
ByteBuffer getRandomSubset(ByteBuffer src)
Get a buffer with a subset (the head) of the data of the source buffer.
Parameters:
src - the source buffer
Returns:
a buffer with a subset of the data
String getScheme()
String getScheme()
boolean isAbsolute()
boolean isAbsolute()
boolean isDirectory()
boolean isDirectory()
long lastModified()
long lastModified()
void moveTo(FilePath newName, boolean atomicReplace)
void moveTo(FilePath newName, boolean atomicReplace)
List newDirectoryStream()
List newDirectoryStream()
InputStream newInputStream()
InputStream newInputStream() throws IOException
OutputStream newOutputStream(boolean append)
OutputStream newOutputStream(boolean append) throws IOException
FileChannel open(String mode)
FileChannel open(String mode) throws IOException
void setDiskFullCount(int count, int seed)
Set the number of write operations before the disk is full, and the random seed (for partial writes).
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
void setPartialWrites(boolean partialWrites)
Whether partial writes are possible (writing only part of the data).
void setPartialWrites(boolean partialWrites)
Whether partial writes are possible (writing only part of the data).
Parameters:
partialWrites - true to enable
boolean setReadOnly()
boolean setReadOnly()
long size()
long size()
FilePath toRealPath()
FilePath toRealPath()