public interface FilesManager
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all contents from this files manager.
|
boolean |
delete(java.lang.String dirPath,
java.lang.String name)
This method deletes the specified file.
|
boolean |
exists(java.lang.String dirPath,
java.lang.String filename)
Tests whether a data exists for this filename.
|
void |
initialize()
Initialize this files manager.
|
java.lang.String[] |
list(java.lang.String dirPath)
Returns an array of strings naming the files in the given directory.
|
void |
move(java.lang.String dirPath,
java.lang.String src,
java.lang.String dst)
Moves a file as a new file.
|
java.io.InputStream |
read(java.lang.String dirPath,
java.lang.String name)
Reads the content of the specified file.
|
void |
shutdown()
Shutdown this files manager.
|
void |
write(java.lang.String dirPath,
java.lang.String name,
java.io.InputStream contents)
Writes the given contents to specified file.
|
void initialize() throws java.io.IOException
java.io.IOException
- If an I/O errors is occur.void shutdown() throws java.io.IOException
java.io.IOException
- If an I/O errors is occur.void clear() throws java.io.IOException
java.io.IOException
- If an I/O errors is occur.void write(java.lang.String dirPath, java.lang.String name, java.io.InputStream contents) throws java.io.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.java.io.IOException
- If an I/O errors is occur.boolean exists(java.lang.String dirPath, java.lang.String filename) throws java.io.IOException
dirPath
- parent directory of the file to be created.filename
- the filename to check.true
if the given ID exists, false
otherwisejava.io.IOException
- if an I/O error occurs.void move(java.lang.String dirPath, java.lang.String src, java.lang.String dst) throws java.io.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.java.io.IOException
- if an I/O error occurs.java.lang.IllegalArgumentException
- if the given source filename is not a valid identifier.java.lang.NullPointerException
- if one of the given parameters is null
.java.io.InputStream read(java.lang.String dirPath, java.lang.String name)
dirPath
- parent directory of the file to be read.name
- name of the file to be read.null
if there no content.boolean delete(java.lang.String dirPath, java.lang.String name) throws java.io.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.java.io.IOException
- if the file does not existjava.lang.String[] list(java.lang.String dirPath) throws java.io.IOException
dirPath
- the directory to list its contents.java.io.IOException
- if the file does not exist