public final class SharedDirectory extends AbstractSharedItem<SharedDirectory>
PATH_SEPARATOR, ROOT_PATH| Constructor and Description |
|---|
SharedDirectory(SharedConnection sharedConnection)
Create a new shared directory based on the shared connection.
|
SharedDirectory(SharedConnection sharedConnection,
String pathName)
Create a new shared directory based on the shared connection and the path name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createDirectory()
Create the current directory.
|
SharedDirectory |
createDirectoryInCurrentDirectory(String directoryName)
Create a directory in the current directory.
|
SharedFile |
createFileInCurrentDirectory(String fileName)
Create a file in the current directory.
|
protected SharedDirectory |
createSharedNodeItem(String pathName)
Create a new shared directory via factory.
|
void |
deleteDirectoryRecursively()
Delete the current directory with all its subdirectories and subfiles.
|
void |
ensureExists()
Ensure that the given directory path does exist - if not, the path is created.
|
boolean |
equals(Object object)
Check if the current and the given objects are equals.
|
List<SharedDirectory> |
getDirectories()
Get all directories of the current directory.
|
List<SharedFile> |
getFiles()
Get all files of the current directory.
|
List<SharedItem> |
listFiles(Predicate<SharedItem> searchPredicate,
boolean searchRecursive)
List all files and directories that match the search predicate.
|
List<SharedItem> |
listFiles(String searchPattern,
boolean searchRecursive)
List all files and directories that match the search pattern.
|
void |
renameTo(String newFileName,
boolean replaceIfExist)
Rename the current item.
|
getChangeTime, getCreationTime, getDiskShare, getLastAccessTime, getLastWriteTime, getName, getParentPath, getPath, getRootPath, getServerName, getSharedConnection, getShareName, getSmbPath, isDirectory, isExisting, isFile, isRootPath, setPathNamepublic SharedDirectory(SharedConnection sharedConnection, String pathName)
sharedConnection - Shared connectionpathName - Path namepublic SharedDirectory(SharedConnection sharedConnection)
sharedConnection - Shared connectionpublic void ensureExists()
public SharedDirectory createDirectoryInCurrentDirectory(String directoryName)
directoryName - Name of the new directorypublic SharedFile createFileInCurrentDirectory(String fileName)
fileName - Name of the new filepublic void createDirectory()
public void deleteDirectoryRecursively()
public List<SharedDirectory> getDirectories()
public List<SharedFile> getFiles()
public List<SharedItem> listFiles(Predicate<SharedItem> searchPredicate, boolean searchRecursive)
searchPredicate - Search predicate that is used for testingsearchRecursive - Flag to search recursivepublic List<SharedItem> listFiles(String searchPattern, boolean searchRecursive)
searchPattern - Search regex pattern that is used for matchingsearchRecursive - Flag to search recursivepublic void renameTo(String newFileName, boolean replaceIfExist)
newFileName - New file namereplaceIfExist - Flag to replace an existing pathpublic boolean equals(Object object)
equals in class AbstractSharedItem<SharedDirectory>object - Given object to compare againstprotected SharedDirectory createSharedNodeItem(String pathName)
createSharedNodeItem in class AbstractSharedItem<SharedDirectory>pathName - Path name of the shared itemCopyright © 2018. All rights reserved.