|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bibalex.daf.handlers.filehandler.LocalFileHandler
public class LocalFileHandler
Manipulates the file/folder operation over local system
| Field Summary | |
|---|---|
private int |
compareResult
|
| Constructor Summary | |
|---|---|
LocalFileHandler()
Creates a new instance of LocalFileHandler. |
|
| Method Summary | |
|---|---|
int |
compareFile(java.lang.String sourceFile,
java.lang.String destFile)
Compare the two given files. |
int |
compareFolder(java.lang.String sourceFolder,
java.lang.String destFolder)
Compares the two given folders. |
boolean |
copyFile(java.lang.String sourceFile,
java.lang.String destFolder)
Copy file from source to destination with ability to change file name. |
private void |
copyFolder(java.lang.String sourceFolder,
java.lang.String destinationFolder)
Copies the folder from source to destination. |
boolean |
copyFolder(java.lang.String sourceParent,
java.lang.String folderName,
java.lang.String destinationParent,
java.lang.String newName,
boolean overwrite)
Copies a folder from source to destination. |
boolean |
createFile(java.lang.String parentPath,
java.lang.String fileName,
boolean overwrite)
Creates a file within the given folder. |
boolean |
createFolder(java.lang.String parentPath,
java.lang.String folderName,
boolean overwrite)
Creates a folder at the specified path. |
boolean |
createPath(java.lang.String path)
Creates the complete path. |
boolean |
deleteFile(java.lang.String parentPath,
java.lang.String fileName)
Deletes the given file. |
boolean |
deleteFolder(java.lang.String folderPath)
Delete the files and subfolder recursively. |
boolean |
folderExists(java.lang.String folderPath)
Determines whether the given folder exists or not. |
private java.lang.String |
formatPath(java.lang.String path)
Format the path according to the current platform. |
java.io.File[] |
getFiles(java.lang.String path)
Gets the files within the given folder. |
int |
getFilesCount(java.lang.String path)
Gets the count of files within the given folder. |
int |
getFilesCountRecursively(java.lang.String path)
Gets the count of files within the given folder recursively. |
int |
getFilesCountWithExt(java.lang.String path,
java.lang.String extension)
Gets the count of files with the specified extention. |
long |
getFileSize(java.lang.String filePath)
Gets the size of the file in bytes. |
java.lang.String[] |
getFilesNames(java.lang.String path)
Gets the names of files within the given folder. |
java.lang.String[] |
getFilesNamesWithExt(java.lang.String path,
java.lang.String extension)
Gets the names of the file with the specified extension within the given folder. |
java.io.File[] |
getFilesRecursively(java.lang.String path)
Gets the files within the given folder recursively. |
java.io.File[] |
getFilesWithExt(java.lang.String path,
java.lang.String extension)
Gets the files with the specified extention. |
long |
getFolderSize(java.lang.String folderPath)
Gets the size of the folder, recursively, in bytes. |
java.lang.String[] |
getSubFolders(java.lang.String path)
Gets the names of subfolders. |
boolean |
moveFile(java.lang.String sourceFile,
java.lang.String destFolder,
boolean overwrite)
Moves file from source to destination with ability to overwrite an old existed copy. |
boolean |
moveFolder(java.lang.String sourceFolder,
java.lang.String destParent,
boolean overwrite)
Move folder from source to destination with ability to overwrite an old existed copy. |
boolean |
rename(java.lang.String path,
java.lang.String newName,
boolean overwrite)
Rename a file or a folder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int compareResult
| Constructor Detail |
|---|
public LocalFileHandler()
| Method Detail |
|---|
public boolean moveFile(java.lang.String sourceFile,
java.lang.String destFolder,
boolean overwrite)
sourceFile - The path of the file to move including the file name.destFolder - The folder to move the file to.overwrite - Whether to overwrite the file at destination or not.
public boolean moveFolder(java.lang.String sourceFolder,
java.lang.String destParent,
boolean overwrite)
sourceFolder - The path of the folder to move including the folder name.destParent - The destination parent folder to which the folder will be moved.overwrite - Whether to overwrite the folder at destination or not.
public boolean deleteFolder(java.lang.String folderPath)
folderPath - The path of the folder to delete.
public boolean deleteFile(java.lang.String parentPath,
java.lang.String fileName)
parentPath - The path to the folder taht contains the file.fileName - The name of the file to delete.
public boolean rename(java.lang.String path,
java.lang.String newName,
boolean overwrite)
path - The path to the folder or the file including the old file/folder name.newName - The new name of the fie or the folder. The parent path is not included.overwrite - Whether to overwrite a file or a folder with the same name or not.
public java.lang.String[] getSubFolders(java.lang.String path)
path - The path of the folder to get its sub-folders
public int getFilesCount(java.lang.String path)
path - The path of the folder to count its files.
public int getFilesCountRecursively(java.lang.String path)
path - The path of the folder to count its files.
public java.io.File[] getFiles(java.lang.String path)
path - The path of the folder to count its files.
public java.io.File[] getFilesRecursively(java.lang.String path)
path - The path of the folder to count its files.
public java.lang.String[] getFilesNames(java.lang.String path)
path - The path of the folder to get its files.
public int getFilesCountWithExt(java.lang.String path,
java.lang.String extension)
path - The folder path to count its files.extension - The extension of the files. The extension is the last 3 letters of the file name without the dot '.' .
public java.io.File[] getFilesWithExt(java.lang.String path,
java.lang.String extension)
path - The folder path to get its files.extension - The extension of the files. The extension is the last 3 letters of the file name without the dot '.' .
public java.lang.String[] getFilesNamesWithExt(java.lang.String path,
java.lang.String extension)
path - The path fo the foldders to get the names of the files within.extension - The extension of the files to get their names. The extension is the last 3 letters of the file name without the dot '.' .
private java.lang.String formatPath(java.lang.String path)
path - The path to reformat.
public boolean createFolder(java.lang.String parentPath,
java.lang.String folderName,
boolean overwrite)
parentPath - The path of the folder at which the folder will be created.folderName - The name of the fooder to create.overwrite - Whether to overwrite a folder with the same name at the parent or not.
public boolean createFile(java.lang.String parentPath,
java.lang.String fileName,
boolean overwrite)
parentPath - The parent folder to create the file in.fileName - The name of the file to create.overwrite - Whether to overwrite a file with the same name at the parent or not
public boolean copyFolder(java.lang.String sourceParent,
java.lang.String folderName,
java.lang.String destinationParent,
java.lang.String newName,
boolean overwrite)
sourceParent - The source parent folder without the name of the folder.folderName - The name of the folder.destinationParent - The destination parent folder without the name of the folder.newName - The new name of the folder.overwrite - Whether to overwrite a folder with the same name at the destination or not.
public boolean folderExists(java.lang.String folderPath)
folderPath - The path of the folder.
private void copyFolder(java.lang.String sourceFolder,
java.lang.String destinationFolder)
sourceFolder - The source folder.destinationFolder - The destination folder.
public int compareFolder(java.lang.String sourceFolder,
java.lang.String destFolder)
sourceFolder - The path to the source folder.destFolder - The path of the destination folder.
public int compareFile(java.lang.String sourceFile,
java.lang.String destFile)
sourceFile - The source file.destFile - The destination file.
public boolean copyFile(java.lang.String sourceFile,
java.lang.String destFolder)
sourceFile - The path to the source file.destFolder - The path of the destination folder.
public long getFolderSize(java.lang.String folderPath)
folderPath - The path of the folder.
public long getFileSize(java.lang.String filePath)
filePath - The path of the file.
public boolean createPath(java.lang.String path)
path - The path to create
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||