public class FilePathDisk extends FilePath
| 构造器和说明 |
|---|
FilePathDisk() |
| 限定符和类型 | 方法和说明 |
|---|---|
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(String suffix,
boolean inTempDir)
Create a new temporary file.
|
void |
delete()
Delete a file or directory if it exists.
|
boolean |
exists()
Checks if a file exists.
|
static String |
expandUserHomeDirectory(String fileName)
Expand '~' to the user home directory.
|
FilePath |
getParent()
Get the parent directory of a file or directory.
|
FilePathDisk |
getPath(String path)
Convert a file to a path.
|
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.
|
boolean |
isRegularFile()
Check if it is a regular file.
|
long |
lastModified()
Get the last modified date of a file
|
void |
moveTo(FilePath newName,
boolean atomicReplace)
Rename a file if this is allowed.
|
List<FilePath> |
newDirectoryStream()
List the files and directories in the given directory.
|
InputStream |
newInputStream()
Create an input stream to read from the file.
|
OutputStream |
newOutputStream(boolean append)
Create an output stream to write into the file.
|
FileChannel |
open(String mode)
Open a random access file object.
|
boolean |
setReadOnly()
Disable the ability to write.
|
long |
size()
Get the size of a file in bytes
|
FilePathDisk |
toRealPath()
Normalize a file name.
|
protected static String |
translateFileName(String fileName)
Translate the file name to the native format.
|
get, getName, newFileChannelOutputStream, register, toString, unregister, unwrappublic FilePathDisk getPath(String path)
FilePathjava.nio.file.spi.FileSystemProvider.getPath, but may
return an object even if the scheme doesn't match in case of the
default file provider.public long size()
FilePathprotected static String translateFileName(String fileName)
fileName - the file namepublic static String expandUserHomeDirectory(String fileName)
fileName - the file namepublic void moveTo(FilePath newName, boolean atomicReplace)
FilePathpublic boolean createFile()
FilePathcreateFile 在类中 FilePathpublic boolean exists()
FilePathpublic void delete()
FilePathpublic List<FilePath> newDirectoryStream()
FilePathnewDirectoryStream 在类中 FilePathpublic boolean canWrite()
FilePathpublic boolean setReadOnly()
FilePathsetReadOnly 在类中 FilePathpublic FilePathDisk toRealPath()
FilePathtoRealPath 在类中 FilePathpublic FilePath getParent()
FilePathpublic boolean isDirectory()
FilePathisDirectory 在类中 FilePathpublic boolean isRegularFile()
FilePathisRegularFile 在类中 FilePathpublic boolean isAbsolute()
FilePathisAbsolute 在类中 FilePathpublic long lastModified()
FilePathlastModified 在类中 FilePathpublic void createDirectory()
FilePathcreateDirectory 在类中 FilePathpublic OutputStream newOutputStream(boolean append) throws IOException
FilePathnewOutputStream 在类中 FilePathappend - if true, the file will grow, if false, the file will be
truncated firstIOException - If an I/O error occurspublic InputStream newInputStream() throws IOException
FilePathnewInputStream 在类中 FilePathIOException - If an I/O error occurspublic FileChannel open(String mode) throws IOException
FilePathopen 在类中 FilePathmode - the access mode. Supported are r, rw, rws, rwdIOException - If an I/O error occurspublic String getScheme()
FilePathjava.nio.file.spi.FileSystemProvider.getScheme.public FilePath createTempFile(String suffix, boolean inTempDir) throws IOException
FilePathcreateTempFile 在类中 FilePathsuffix - the suffixinTempDir - if the file should be stored in the temporary directoryIOException - on failureCopyright © 2022. All rights reserved.