public class UniversalFile extends File
| Modifier and Type | Class and Description |
|---|---|
static class |
UniversalFile.FileAccessException |
pathSeparator, pathSeparatorChar, separator, separatorChar| Constructor and Description |
|---|
UniversalFile(File coreFile) |
UniversalFile(File parent,
String childPath) |
UniversalFile(String path) |
UniversalFile(String parentPath,
String childPath) |
UniversalFile(UniversalFile parent,
String childPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(UniversalFile destinationDir,
boolean replaceExisting)
Copies this file.
|
boolean |
delete() |
void |
delete(boolean forceDirDelete)
Deletes this file.
|
UniversalFile |
getAbsoluteFile() |
UniversalFile |
getCanonicalFile() |
String |
getContentString() |
static UniversalFile[] |
getFiles(String... paths) |
InputStream |
getInputStream() |
String |
getMd5Checksum() |
String |
getMd5Checksum(int bufferSize) |
static UniversalFile |
getOrCreateDirectory(File dir)
Gets given directory.
|
static UniversalFile |
getOrCreateDirectory(String dirPath)
Convenience method.
|
UniversalFile |
getParentFile() |
String |
getRelativeTo(UniversalFile other) |
UniversalFile[] |
listFiles() |
UniversalFile[] |
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 UniversalFile(String path)
public UniversalFile(UniversalFile parent, String childPath)
public UniversalFile(File coreFile)
public static UniversalFile[] getFiles(String... paths)
public static UniversalFile getOrCreateDirectory(File dir) throws UniversalFile.FileAccessException
dir - directoryUniversalFile.FileAccessException - if an error happened during the process hierarchy does not exist and it was not possible to create it.public static UniversalFile getOrCreateDirectory(String dirPath) throws UniversalFile.FileAccessException
public UniversalFile[] listFiles()
public UniversalFile[] listFiles(FilenameFilter filter)
public UniversalFile getParentFile()
getParentFile in class Filepublic UniversalFile getAbsoluteFile()
getAbsoluteFile in class Filepublic UniversalFile getCanonicalFile() throws IOException
getCanonicalFile in class FileIOExceptionpublic String getRelativeTo(UniversalFile other)
public InputStream getInputStream() throws IOException
IOExceptionpublic String getContentString() throws IOException
IOExceptionpublic String getMd5Checksum(int bufferSize) throws UniversalFile.FileAccessException
public final String getMd5Checksum() throws UniversalFile.FileAccessException
public void delete(boolean forceDirDelete)
throws UniversalFile.FileAccessException
forceDirDelete - force directory exclusion even if it contains files. USE IT WITH EXTREME CAREFUL !!!UniversalFile.FileAccessException - if given file does not exist or could not be deleted.public final boolean delete()
throws UniversalFile.FileAccessException
delete in class FileUniversalFile.FileAccessExceptionpublic void copy(UniversalFile destinationDir, boolean replaceExisting) throws UniversalFile.FileAccessException
destinationDir - destination directory (will be created if it does not exist).replaceExisting - defines if existing items shall be replaced.UniversalFile.FileAccessException - if an error happened during the operation.Copyright © 2016 Leandro José Britto de Oliveira. All rights reserved.