public class Path
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BUFFER_SIZE |
protected java.io.File |
file |
| Constructor and Description |
|---|
Path(java.io.File file) |
Path(java.io.File dir,
java.lang.String name) |
Path(Path destination,
java.lang.String fileName) |
Path(java.lang.String path) |
Path(java.lang.String dirPath,
java.lang.String name) |
Path(java.net.URI uri) |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(java.lang.String destinationPath)
Copy recursively into specific directory
|
static void |
copy(java.lang.String sourcePath,
java.lang.String destinationPath) |
void |
createDirectory()
Creates directory
|
static void |
createDirectory(java.lang.String path)
Creates directory
|
void |
createFile()
Creates file
|
static void |
createFile(java.lang.String path)
Creates file
|
void |
delete()
Delete all files recursively.
|
static void |
delete(java.lang.String path)
Delete all files recursively
|
static java.lang.String |
getAppFilesSdDir(android.content.Context context)
Get SD app files directory
|
static java.lang.String |
getCacheDir(android.content.Context context)
Get app cache directory
|
java.io.FileReader |
getFileReader()
get file reader for Text operations
|
Path[] |
getFilesList(java.io.FilenameFilter filter) |
static Path[] |
getFilesList(java.lang.String path,
java.io.FilenameFilter filter) |
java.io.FileWriter |
getFileWriter()
get file writer for Text operations
|
java.io.FileWriter |
getFileWriter(boolean append)
get file writer for Text operations
|
java.io.FileInputStream |
getInputStream() |
long |
getModificationDate()
Modification date is not affected after renaming and copying
|
java.lang.String |
getName() |
java.io.FileOutputStream |
getOutputStream() |
java.io.FileOutputStream |
getOutputStream(boolean append) |
Path |
getParentPath() |
java.lang.String[] |
getPathsList(java.io.FilenameFilter filter) |
static java.lang.String[] |
getPathsList(java.lang.String path,
java.io.FilenameFilter filter) |
static java.lang.String |
getSdDir()
Get SD card directory
|
long |
getSize() |
java.lang.String |
getStringPath() |
boolean |
isDirectory() |
boolean |
isExists()
Makes exist command more uniform
|
static boolean |
isExists(java.lang.String path)
Check if string path exist
|
static boolean |
isExternalStorageReadable()
Checks if external storage is available to read
|
static boolean |
isExternalStorageWritable()
Checks if external storage is available for read and write
|
boolean |
isFile() |
boolean |
isNotExists() |
void |
setName(java.lang.String newName) |
java.io.File |
toFile()
In case of changing implementation
|
static Path |
toPath(java.io.File file)
Converts file to Path.
|
static Path |
toPath(java.lang.String... pathElements)
Create path from elements
|
java.lang.String |
toString() |
protected static final int BUFFER_SIZE
protected java.io.File file
public Path(java.io.File file)
public Path(java.io.File dir,
java.lang.String name)
public Path(java.lang.String path)
public Path(java.lang.String dirPath,
java.lang.String name)
public Path(java.net.URI uri)
public Path(Path destination, java.lang.String fileName)
public static Path toPath(java.io.File file)
public static Path toPath(java.lang.String... pathElements)
public static boolean isExists(java.lang.String path)
public static java.lang.String getSdDir()
public static java.lang.String getAppFilesSdDir(android.content.Context context)
ReadPathException - if cannot be readpublic static java.lang.String getCacheDir(android.content.Context context)
ReadPathException - if cannot be readpublic static void createDirectory(java.lang.String path)
FileExistPathException - - if already existpublic static void createFile(java.lang.String path)
FileExistPathException - if already existWritePathException - if cannot writepublic static void delete(java.lang.String path)
public static void copy(java.lang.String sourcePath,
java.lang.String destinationPath)
public static boolean isExternalStorageWritable()
public static boolean isExternalStorageReadable()
public static java.lang.String[] getPathsList(java.lang.String path,
java.io.FilenameFilter filter)
public static Path[] getFilesList(java.lang.String path, java.io.FilenameFilter filter)
public java.io.File toFile()
public boolean isExists()
public boolean isNotExists()
public void createDirectory()
FileExistPathException - - if already existpublic void createFile()
FileExistPathException - if already existWritePathException - if cannot writepublic void delete()
public void copy(java.lang.String destinationPath)
destinationPath - path where the path will be copied topublic java.lang.String[] getPathsList(java.io.FilenameFilter filter)
public Path[] getFilesList(java.io.FilenameFilter filter)
public long getSize()
public long getModificationDate()
public Path getParentPath()
public java.io.FileOutputStream getOutputStream(boolean append)
public java.io.FileOutputStream getOutputStream()
getOutputStream(false)public java.io.FileInputStream getInputStream()
FileNotExistPathException - if file not existpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getStringPath()
public java.io.FileReader getFileReader()
FileNotExistPathExceptionpublic java.io.FileWriter getFileWriter()
FileNotExistPathExceptionpublic java.io.FileWriter getFileWriter(boolean append)
FileNotExistPathExceptionpublic boolean isFile()
public boolean isDirectory()
public java.lang.String getName()
public void setName(java.lang.String newName)