public class FilePathUnstable extends FilePathWrapper
| Constructor and Description |
|---|
FilePathUnstable() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canWrite()
Check if the file is writable.
|
void |
createDirectory()
Create a directory (all required parent directories already exist).
|
boolean |
createFile()
Create a new file.
|
FilePath |
createTempFile(java.lang.String suffix,
boolean deleteOnExit,
boolean inTempDir)
Create a new temporary file.
|
void |
delete()
Delete a file or directory if it exists.
|
boolean |
exists()
Checks if a file exists.
|
int |
getDiskFullCount() |
java.lang.String |
getName()
Get the file or directory name (the last element of the path).
|
FilePath |
getParent()
Get the parent directory of a file or directory.
|
java.lang.String |
getScheme()
Get the scheme (prefix) for this file provider.
|
boolean |
isAbsolute()
Check if the file name includes a path.
|
boolean |
isDirectory()
Check if it is a file or a directory.
|
long |
lastModified()
Get the last modified date of a file
|
void |
moveTo(FilePath newName,
boolean atomicReplace)
Rename a file if this is allowed.
|
java.util.List<FilePath> |
newDirectoryStream()
List the files and directories in the given directory.
|
java.io.InputStream |
newInputStream()
Create an input stream to read from the file.
|
java.io.OutputStream |
newOutputStream(boolean append)
Create an output stream to write into the file.
|
java.nio.channels.FileChannel |
open(java.lang.String mode)
Open a random access file object.
|
static FilePathUnstable |
register()
Register the file system.
|
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 |
setPartialWrites(boolean partialWrites)
Whether partial writes are possible (writing only part of the data).
|
boolean |
setReadOnly()
Disable the ability to write.
|
long |
size()
Get the size of a file in bytes
|
FilePath |
toRealPath()
Normalize a file name.
|
getBase, getPath, getPrefix, unwrap, unwrap, wrapget, getNextTempFileNamePart, register, toString, unregisterpublic static FilePathUnstable register()
public void setDiskFullCount(int count,
int seed)
count - the number of write operations (0 to never fail,
Integer.MAX_VALUE to count the operations)seed - the new seedpublic int getDiskFullCount()
public void setPartialWrites(boolean partialWrites)
partialWrites - true to enablepublic void createDirectory()
FilePathcreateDirectory in class FilePathWrapperpublic boolean createFile()
FilePathcreateFile in class FilePathWrapperpublic void delete()
FilePathdelete in class FilePathWrapperpublic boolean exists()
FilePathexists in class FilePathWrapperpublic java.lang.String getName()
FilePathpublic long lastModified()
FilePathlastModified in class FilePathWrapperpublic FilePath getParent()
FilePathgetParent in class FilePathWrapperpublic boolean isAbsolute()
FilePathisAbsolute in class FilePathWrapperpublic boolean isDirectory()
FilePathisDirectory in class FilePathWrapperpublic boolean canWrite()
FilePathcanWrite in class FilePathWrapperpublic boolean setReadOnly()
FilePathsetReadOnly in class FilePathWrapperpublic long size()
FilePathsize in class FilePathWrapperpublic java.util.List<FilePath> newDirectoryStream()
FilePathnewDirectoryStream in class FilePathWrapperpublic FilePath toRealPath()
FilePathtoRealPath in class FilePathWrapperpublic java.io.InputStream newInputStream()
throws java.io.IOException
FilePathnewInputStream in class FilePathWrapperjava.io.IOExceptionpublic java.nio.channels.FileChannel open(java.lang.String mode)
throws java.io.IOException
FilePathopen in class FilePathWrappermode - the access mode. Supported are r, rw, rws, rwdjava.io.IOExceptionpublic java.io.OutputStream newOutputStream(boolean append)
throws java.io.IOException
FilePathnewOutputStream in class FilePathWrapperappend - if true, the file will grow, if false, the file will be
truncated firstjava.io.IOExceptionpublic void moveTo(FilePath newName, boolean atomicReplace)
FilePathmoveTo in class FilePathWrappernewName - the new fully qualified file nameatomicReplace - whether the move should be atomic, and the target
file should be replaced if it exists and replacing is possiblepublic FilePath createTempFile(java.lang.String suffix, boolean deleteOnExit, boolean inTempDir) throws java.io.IOException
FilePathcreateTempFile in class FilePathWrappersuffix - the suffixdeleteOnExit - if the file should be deleted when the virtual
machine existsinTempDir - if the file should be stored in the temporary directoryjava.io.IOException