public interface FilesManager
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all contents from this files manager.
|
boolean |
delete(String dirPath,
String name)
This method deletes the specified file.
|
boolean |
exists(String dirPath,
String filename)
Tests whether a data exists for this filename.
|
void |
initialize()
Initialize this files manager.
|
String[] |
list(String dirPath)
Returns an array of strings naming the files in the given directory.
|
void |
move(String dirPath,
String src,
String dst)
Moves a file as a new file.
|
InputStream |
read(String dirPath,
String name)
Reads the content of the specified file.
|
void |
shutdown()
Shutdown this files manager.
|
void |
write(String dirPath,
String name,
InputStream contents)
Writes the given contents to specified file.
|
void clear() throws IOException
IOException
- If an I/O errors is occur.boolean delete(String dirPath, String name) throws IOException
dirPath
- parent directory of the file to be deleted.name
- name of the file to be deleted.true
if the file was deleted, false
otherwise.IOException
- if the file does not existboolean exists(String dirPath, String filename) throws IOException
dirPath
- parent directory of the file to be created.filename
- the filename to check.true
if the given ID exists, false
otherwiseIOException
- if an I/O error occurs.void initialize() throws IOException
IOException
- If an I/O errors is occur.String[] list(String dirPath) throws IOException
dirPath
- the directory to list its contents.IOException
- if the file does not existvoid move(String dirPath, String src, String dst) throws IOException
If a file is already stored with the given destination filename, it is overwritten. The given source filename must denote a file.
dirPath
- parent directory of the file to be created.src
- the filename of the file to move.dst
- the filename destination of the new file.IOException
- if an I/O error occurs.IllegalArgumentException
- if the given source filename is not a valid identifier.NullPointerException
- if one of the given parameters is null
.InputStream read(String dirPath, String name)
dirPath
- parent directory of the file to be read.name
- name of the file to be read.null
if there no content.void shutdown() throws IOException
IOException
- If an I/O errors is occur.void write(String dirPath, String name, InputStream contents) throws IOException
The specified path is relative the root directory. The method creates all necessary parent directories.
dirPath
- parent directory of the file to be created.name
- name of the file to be created.contents
- contents of the file to be created.IOException
- If an I/O errors is occur.