java.nio.file.Path,
but simpler, and works with older versions of Java. It also implements the
relevant methods found in java.nio.file.FileSystem and
FileSystems
| Modifier and Type | Field and Description |
|---|---|
| private static final FilePath | |
| public String | name
The complete path (which may be absolute or relative, depending on the file system). |
| private static final ConcurrentHashMap | |
| private static String | tempRandom
The prefix for temporary files. |
| private static long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract boolean | |
| public abstract void | |
| public abstract boolean | |
| public FilePath | Returns: the name of the created filethe suffix suffix, boolean if the file should be stored in the temporary directory inTempDir)Create a new temporary file. |
| public abstract void | |
| public abstract boolean | |
| public static FilePath | |
| public String | Returns: the last element of the pathGet the file or directory name (the last element of the path). |
| private static synchronized String | Returns: the file name partif the random part of the filename should change newRandom)Get the next temporary file name part (the part in the middle). |
| public abstract FilePath | |
| public abstract FilePath | |
| public abstract String | |
| public abstract boolean | |
| public abstract boolean | |
| public abstract boolean | |
| public abstract long | |
| public abstract void | |
| public abstract List | Returns: the list of fully qualified file namesList the files and directories in the given directory. |
| public static OutputStream | Returns: the output streamthe file channel channel, boolean true for append mode, false for truncate and overwrite append)Create a new output stream from the channel. |
| public InputStream | |
| public OutputStream | Returns: the output streamif true, the file will grow, if false, the file will be
truncated first append)Create an output stream to write into the file. |
| public abstract FileChannel | |
| public static void | |
| public abstract boolean | |
| public abstract long | |
| public abstract FilePath | |
| public String | Returns: the path as a stringOverrides java. Get the string representation. |
| public static void | |
| public FilePath | Returns: the unwrapped pathGet the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used). |
| defaultProvider | back to summary |
|---|---|
| private static final FilePath defaultProvider | |
| name | back to summary |
|---|---|
| public String name The complete path (which may be absolute or relative, depending on the file system). | |
| providers | back to summary |
|---|---|
| private static final ConcurrentHashMap<String, FilePath> providers | |
| tempRandom | back to summary |
|---|---|
| private static String tempRandom The prefix for temporary files. | |
| tempSequence | back to summary |
|---|---|
| private static long tempSequence | |
| FilePath | back to summary |
|---|---|
| public FilePath() | |
| canWrite | back to summary |
|---|---|
| public abstract boolean canWrite() Check if the file is writable.
| |
| createDirectory | back to summary |
|---|---|
| public abstract void createDirectory() Create a directory (all required parent directories already exist). | |
| createFile | back to summary |
|---|---|
| public abstract boolean createFile() Create a new file.
| |
| createTempFile | back to summary |
|---|---|
| public FilePath createTempFile(String suffix, boolean inTempDir) throws IOException Create a new temporary file.
| |
| delete | back to summary |
|---|---|
| public abstract void delete() Delete a file or directory if it exists. Directories may only be deleted if they are empty. | |
| exists | back to summary |
|---|---|
| public abstract boolean exists() Checks if a file exists.
| |
| get | back to summary |
|---|---|
| public static FilePath get(String path) Get the file path object for the given path. Windows-style '\' is replaced with '/'. | |
| getName | back to summary |
|---|---|
| public String getName() Get the file or directory name (the last element of the path).
| |
| getNextTempFileNamePart | back to summary |
|---|---|
| private static synchronized String getNextTempFileNamePart(boolean newRandom) Get the next temporary file name part (the part in the middle).
| |
| getParent | back to summary |
|---|---|
| public abstract FilePath getParent() Get the parent directory of a file or directory.
| |
| getPath | back to summary |
|---|---|
| public abstract FilePath getPath(String path) Convert a file to a path. This is similar to
| |
| getScheme | back to summary |
|---|---|
| public abstract String getScheme() Get the scheme (prefix) for this file provider.
This is similar to
| |
| isAbsolute | back to summary |
|---|---|
| public abstract boolean isAbsolute() Check if the file name includes a path.
| |
| isDirectory | back to summary |
|---|---|
| public abstract boolean isDirectory() Check if it is a file or a directory.
| |
| isRegularFile | back to summary |
|---|---|
| public abstract boolean isRegularFile() Check if it is a regular file.
| |
| lastModified | back to summary |
|---|---|
| public abstract long lastModified() Get the last modified date of a file
| |
| moveTo | back to summary |
|---|---|
| public abstract void moveTo(FilePath newName, boolean atomicReplace) Rename a file if this is allowed.
| |
| newDirectoryStream | back to summary |
|---|---|
| public abstract List List the files and directories in the given directory. | |
| newFileChannelOutputStream | back to summary |
|---|---|
| public static OutputStream newFileChannelOutputStream(FileChannel channel, boolean append) throws IOException Create a new output stream from the channel.
| |
| newInputStream | back to summary |
|---|---|
| public InputStream newInputStream() throws IOException Create an input stream to read from the file.
| |
| newOutputStream | back to summary |
|---|---|
| public OutputStream newOutputStream(boolean append) throws IOException Create an output stream to write into the file.
| |
| open | back to summary |
|---|---|
| public abstract FileChannel open(String mode) throws IOException Open a random access file object.
| |
| register | back to summary |
|---|---|
| public static void register(FilePath provider) Register a file provider.
| |
| setReadOnly | back to summary |
|---|---|
| public abstract boolean setReadOnly() Disable the ability to write.
| |
| size | back to summary |
|---|---|
| public abstract long size() Get the size of a file in bytes
| |
| toRealPath | back to summary |
|---|---|
| public abstract FilePath toRealPath() Normalize a file name.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Get the string representation. The returned string can be used to construct a new object. | |
| unregister | back to summary |
|---|---|
| public static void unregister(FilePath provider) Unregister a file provider.
| |
| unwrap | back to summary |
|---|---|
| public FilePath unwrap() Get the unwrapped file name (without wrapper prefixes if wrapping / delegating file systems are used).
| |