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 absolute) |
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
|
File[] |
listFiles()
List the files in the current directory
|
File[] |
listFiles(String path)
List the files in the given remote directory
|
GenericFile<File> |
newGenericFile()
Creates a new instance of
GenericFile |
void |
releaseRetrievedFileResources(org.apache.camel.Exchange exchange)
Releases the resources consumed by a retrieved file
|
boolean |
renameFile(String from,
String to)
Renames the file
|
boolean |
retrieveFile(String name,
org.apache.camel.Exchange exchange,
long size)
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,
org.apache.camel.Exchange exchange,
long size)
Stores the content as a new remote file (upload)
|
public FileOperations()
public FileOperations(FileEndpoint endpoint)
public GenericFile<File> newGenericFile()
GenericFileOperationsGenericFilenewGenericFile in interface GenericFileOperations<File>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, boolean absolute)
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 - whether the directory is an absolute or relative pathGenericFileOperationFailedException - can be thrownpublic File[] listFiles() throws GenericFileOperationFailedException
GenericFileOperationslistFiles in interface GenericFileOperations<File>GenericFileOperationFailedException - can be thrownpublic 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, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException
GenericFileOperationsretrieveFile in interface GenericFileOperations<File>name - name of the fileexchange - stream to write the content of the file intosize - the total file size to retrieve, if possible to determineGenericFileOperationFailedException - can be thrownpublic void releaseRetrievedFileResources(org.apache.camel.Exchange exchange)
throws GenericFileOperationFailedException
GenericFileOperationsreleaseRetrievedFileResources in interface GenericFileOperations<File>exchange - exchange with the content of the fileGenericFileOperationFailedException - can be thrownpublic boolean storeFile(String fileName, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException
GenericFileOperationsstoreFile in interface GenericFileOperations<File>fileName - name of new fileexchange - with the content content of the filesize - the total file size to store, if possible to determineGenericFileOperationFailedException - can be thrownApache Camel