public interface IFileSystem
Modifier and Type | Method and Description |
---|---|
void |
createFile(String file,
Object content)
Creates the given file with the given content.
|
void |
createFolder(String folder)
Creates the given folder in the file system.
|
Object |
getFile(String file)
Returns the content of the file with the given name.
|
String[] |
getFolderContent(String folder)
Returns the content of a folder as an array of strings.
|
Iterator |
getFolderIterator(String folder)
Returns an iterator for walking through the folders content.
|
boolean |
isFolder(String folder)
Tests if the given folder exists in the file system.
|
void |
moveFile(String source,
String destination)
Moves the given file to the given destination.
|
void |
removeFile(String file)
Removes the given file from the file system.
|
void |
removeFolder(String folder)
Removes the given folder from the file system.
|
void createFolder(String folder) throws FileExistsException, InvalidNameException
folder
- the folder to createFileExistsException
- -
if the folder already existsInvalidNameException
- -
if folder is no absolute namevoid removeFolder(String folder) throws NoSuchFileException, InvalidNameException
folder
- the folder to remove from the file systemNoSuchFileException
- -
if the folder does not existInvalidNameException
- -
if folder name is not absolute or the folder is / or
otherwise invalidboolean isFolder(String folder)
folder
- the folder to search and testString[] getFolderContent(String folder) throws NoSuchFileException, InvalidNameException
folder
- the name of the folderNoSuchFileException
InvalidNameException
Iterator getFolderIterator(String folder) throws NoSuchFileException, InvalidNameException
folder
- the name of the folderNoSuchFileException
InvalidNameException
void createFile(String file, Object content) throws FileExistsException, InvalidNameException, NoSuchFileException, InvalidContentException
file
- the file to createcontent
- the file contentFileExistsException
- -
if the file already existsInvalidContentException
- -
if the file content is nullNoSuchFileException
- -
if the folder in which the file should be created does not
existInvalidNameException
- -
if the file name is not absolute or not valid, e.g. ends with /void removeFile(String file) throws NoSuchFileException, InvalidNameException
file
- the file to removedNoSuchFileException
- -
if the file cannot be foundInvalidNameException
- -
if file is no absolute nameObject getFile(String file) throws NoSuchFileException, InvalidNameException
file
- the file from which to return the contentNoSuchFileException
- -
if the file was not foundInvalidNameException
- -
if file is no absolute namevoid moveFile(String source, String destination) throws NoSuchFileException, FileExistsException, InvalidNameException
source
- the source filedestination
- the destination fileNoSuchFileException
- -
if the source file does not existsFileExistsException
- -
if the destination file already existsInvalidNameException
- -
if source or destination is no absolute name