public class Path extends File
| Modifier and Type | Class and Description |
|---|---|
static class |
Path.PathAccessException |
pathSeparator, pathSeparatorChar, separator, separatorChar| Constructor and Description |
|---|
Path(File coreFile) |
Path(File parent,
String childPath) |
Path(Path parent,
String childPath) |
Path(String path) |
Path(String parentPath,
String childPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(Path destinationDir,
boolean replaceExisting)
Copies path contents.
|
boolean |
delete() |
void |
delete(boolean forceDirDelete)
Deletes the pointed location.
|
Path |
getAbsoluteFile() |
Path |
getCanonicalFile() |
InputStream |
getInputStream() |
String |
getMd5Checksum() |
String |
getMd5Checksum(int bufferSize) |
static Path |
getOrCreateDirectory(String dirPath)
Gets given directory.
|
static Path |
getOrCreateParentDir(String filePath)
Considers given path as pointing to a file and return parent directory.
|
Path |
getParentFile() |
String |
getRelativeTo(Path other) |
String |
getStringContents() |
Path[] |
listFiles() |
Path[] |
listFiles(FilenameFilter filter) |
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, deleteOnExit, equals, exists, getAbsolutePath, getCanonicalPath, getFreeSpace, getName, getParent, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURLpublic static Path getOrCreateDirectory(String dirPath) throws Path.PathAccessException
dirPath - directory pathPath.PathAccessException - if an error happened during the process hierarchy does not exist and it was not possible to create it.public static Path getOrCreateParentDir(String filePath) throws Path.PathAccessException
filePath - path pointing to a file.Path.PathAccessException - if an error happened during the process hierarchy does not exist and it was not possible to create it.public Path[] listFiles(FilenameFilter filter)
public Path getParentFile()
getParentFile in class Filepublic Path getAbsoluteFile()
getAbsoluteFile in class Filepublic Path getCanonicalFile() throws IOException
getCanonicalFile in class FileIOExceptionpublic InputStream getInputStream() throws IOException
IOExceptionpublic String getStringContents() throws IOException
IOExceptionpublic String getMd5Checksum(int bufferSize) throws Path.PathAccessException
Path.PathAccessExceptionpublic final String getMd5Checksum() throws Path.PathAccessException
Path.PathAccessExceptionpublic void delete(boolean forceDirDelete)
throws Path.PathAccessException
forceDirDelete - force directory exclusion even if it contains files. USE IT WITH EXTREME CAREFUL !!!Path.PathAccessException - if given file does not exist or could not be deleted.public final boolean delete()
throws Path.PathAccessException
delete in class FilePath.PathAccessExceptionpublic void copy(Path destinationDir, boolean replaceExisting) throws Path.PathAccessException
destinationDir - destination directory (will be created if it does not exist).replaceExisting - defines if existing items shall be replaced.Path.PathAccessException - if an error happened during the operation.Copyright © 2016 Leandro José Britto de Oliveira. All rights reserved.