public class FileOperations extends Object implements GenericFileOperations<File>
File.| Constructor and Description |
|---|
FileOperations() |
FileOperations(FileEndpoint endpoint) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
buildDirectory(File dir,
Set<PosixFilePermission> permissions) |
boolean |
buildDirectory(String directory,
boolean absolute)
Builds the directory structure.
|
void |
changeCurrentDirectory(String path)
Change the current remote directory
|
void |
changeToParentDirectory()
Change the current remote directory to the parent
|
boolean |
deleteFile(String name)
Deletes the file name by name, relative to the current directory
|
boolean |
existsFile(String name)
Determines whether the files exists or not
|
String |
getCurrentDirectory()
Gets the current remote directory
|
List<File> |
listFiles()
List the files in the current directory
|
List<File> |
listFiles(String path)
List the files in the given remote directory
|
void |
releaseRetreivedFileResources(Exchange exchange)
Releases the resources consumed by a retrieved file
|
boolean |
renameFile(String from,
String to)
Renames the file
|
boolean |
retrieveFile(String name,
Exchange exchange)
Retrieves the file
|
void |
setEndpoint(GenericFileEndpoint<File> endpoint)
Sets the endpoint as some implementations need access to the endpoint and how its configured.
|
boolean |
storeFile(String fileName,
Exchange exchange)
Stores the content as a new remote file (upload)
|
public FileOperations()
public FileOperations(FileEndpoint endpoint)
public void setEndpoint(GenericFileEndpoint<File> endpoint)
GenericFileOperationssetEndpoint in interface GenericFileOperations<File>endpoint - the endpointpublic boolean deleteFile(String name) throws GenericFileOperationFailedException
GenericFileOperationsdeleteFile in interface GenericFileOperations<File>name - name of the fileGenericFileOperationFailedException - can be thrownpublic boolean renameFile(String from, String to) throws GenericFileOperationFailedException
GenericFileOperationsrenameFile in interface GenericFileOperations<File>from - original nameto - the new nameGenericFileOperationFailedException - can be thrownpublic boolean existsFile(String name) throws GenericFileOperationFailedException
GenericFileOperationsexistsFile in interface GenericFileOperations<File>name - name of the fileGenericFileOperationFailedException - can be thrownprotected boolean buildDirectory(File dir, Set<PosixFilePermission> permissions)
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException
GenericFileOperationsbuildDirectory in interface GenericFileOperations<File>directory - the directory path to build as a relative string nameabsolute - wether the directory is an absolute or relative pathGenericFileOperationFailedException - can be thrownpublic List<File> listFiles() throws GenericFileOperationFailedException
GenericFileOperationslistFiles in interface GenericFileOperations<File>GenericFileOperationFailedException - can be thrownpublic List<File> listFiles(String path) throws GenericFileOperationFailedException
GenericFileOperationslistFiles in interface GenericFileOperations<File>path - the remote directoryGenericFileOperationFailedException - can be thrownpublic void changeCurrentDirectory(String path) throws GenericFileOperationFailedException
GenericFileOperationschangeCurrentDirectory in interface GenericFileOperations<File>path - the path to change toGenericFileOperationFailedException - can be thrownpublic void changeToParentDirectory()
throws GenericFileOperationFailedException
GenericFileOperationschangeToParentDirectory in interface GenericFileOperations<File>GenericFileOperationFailedException - can be thrownpublic String getCurrentDirectory() throws GenericFileOperationFailedException
GenericFileOperationsgetCurrentDirectory in interface GenericFileOperations<File>GenericFileOperationFailedException - can be thrownpublic boolean retrieveFile(String name, Exchange exchange) throws GenericFileOperationFailedException
GenericFileOperationsretrieveFile in interface GenericFileOperations<File>name - name of the fileexchange - stream to write the content of the file intoGenericFileOperationFailedException - can be thrownpublic void releaseRetreivedFileResources(Exchange exchange) throws GenericFileOperationFailedException
GenericFileOperationsreleaseRetreivedFileResources in interface GenericFileOperations<File>exchange - exchange with the content of the fileGenericFileOperationFailedException - can be thrownpublic boolean storeFile(String fileName, Exchange exchange) throws GenericFileOperationFailedException
GenericFileOperationsstoreFile in interface GenericFileOperations<File>fileName - name of new fileexchange - with the content content of the fileGenericFileOperationFailedException - can be thrownCopyright © 2007–2016 The Apache Software Foundation. All rights reserved.