|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileHandler
File operations that are performed in Cargo. All file operations must use this interface. This interface is also useful for unit testing as it's possible to create a mock implementation of it to prevent actual file operations from happening.
| Method Summary | |
|---|---|
java.lang.String |
append(java.lang.String path,
java.lang.String suffixToAppend)
Append a suffix path to an existing path. |
void |
copy(java.io.InputStream in,
java.io.OutputStream out)
Copies data from an InputStream to an OutputStream using a default buffer size. |
void |
copy(java.io.InputStream in,
java.io.OutputStream out,
int bufSize)
Copies data from an InputStream to an OutputStream. |
void |
copyDirectory(java.lang.String source,
java.lang.String target)
Copy a directory from a source to a destination. |
void |
copyDirectory(java.lang.String source,
java.lang.String target,
java.util.List excludes)
Copy a directory from a source to a destination specifying files to be excluded. |
void |
copyFile(java.lang.String source,
java.lang.String target)
Copy a file from a source to a destination specifying if source files may overwrite newer destination files. |
java.lang.String |
createDirectory(java.lang.String parentDir,
java.lang.String name)
Convenience method for creating a new directory inside another one. |
void |
createFile(java.lang.String file)
Create a file. |
java.lang.String |
createUniqueTmpDirectory()
Creates a unique temporary directory. |
void |
delete(java.lang.String path)
Deletes a file or directory, removing any children as appropriate. |
boolean |
exists(java.lang.String path)
|
java.lang.String[] |
getChildren(java.lang.String directory)
|
java.io.InputStream |
getInputStream(java.lang.String file)
|
java.lang.String |
getName(java.lang.String file)
|
java.io.OutputStream |
getOutputStream(java.lang.String file)
|
java.lang.String |
getParent(java.lang.String path)
|
java.lang.String |
getTmpPath(java.lang.String name)
Compute the location of a temporary directory. |
java.lang.String |
getURL(java.lang.String path)
|
boolean |
isDirectory(java.lang.String path)
|
boolean |
isDirectoryEmpty(java.lang.String dir)
|
void |
mkdirs(java.lang.String path)
Create directories for the passed path. |
| Method Detail |
|---|
void copyFile(java.lang.String source,
java.lang.String target)
source - the file to copy from. Must not be null.target - the file to copy to. Must not be null.
void copyDirectory(java.lang.String source,
java.lang.String target)
source - the directory to copy from. Must not be null.target - the directory to copy to. Must not be null.
void copyDirectory(java.lang.String source,
java.lang.String target,
java.util.List excludes)
source - the directory to copy from. Must not be null.target - the directory to copy to. Must not be null.excludes - the list of files to be excluded. Each entry in the list is an
Ant file pattern.
java.lang.String createDirectory(java.lang.String parentDir,
java.lang.String name)
parentDir - The directory in which the new directory should be createdname - The name of the directory to create
void copy(java.io.InputStream in,
java.io.OutputStream out,
int bufSize)
in - InputStream to copy data fromout - OutputStream to copy data tobufSize - size of the copy buffer
void copy(java.io.InputStream in,
java.io.OutputStream out)
in - InputStream to copy data fromout - OutputStream to copy data tojava.lang.String getTmpPath(java.lang.String name)
name - The name of the directory to compute inside the tmp directory
java.lang.String createUniqueTmpDirectory()
void delete(java.lang.String path)
path - the path to the file or directory to removejava.io.InputStream getInputStream(java.lang.String file)
file - the file for which to get an InputStream for
java.io.OutputStream getOutputStream(java.lang.String file)
file - the file for which to get an OutputStream for
java.lang.String append(java.lang.String path,
java.lang.String suffixToAppend)
path - the path to append tosuffixToAppend - the suffix to append to the path
void mkdirs(java.lang.String path)
path - the path for which to create all directories leading to itjava.lang.String getParent(java.lang.String path)
path - the path for which to return its parent
boolean exists(java.lang.String path)
path - the path to check the existence for
void createFile(java.lang.String file)
file - the file to createboolean isDirectoryEmpty(java.lang.String dir)
dir - the directory to check
boolean isDirectory(java.lang.String path)
path - the path to verify
java.lang.String getName(java.lang.String file)
file - the file name for which to return the file name
java.lang.String getURL(java.lang.String path)
path - the path for which to return the URL
java.lang.String[] getChildren(java.lang.String directory)
directory - the directory for which to return all children
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||