Modifier and Type | Field and Description |
---|---|
static char |
SEPARATOR_CHAR
The character used to separate directories with sub-directories or files.
|
Constructor and Description |
---|
StorageImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
exists(String id)
Tests whether a data exists for this ID.
|
String[] |
getIds()
Returns all IDs of the stored data.
|
InputStream |
load(String id)
Returns the data stored with a specific ID or
null if there is none. |
void |
move(String src,
String dst)
Changes the ID of a data.
|
void |
remove(String id)
Removes the data stored with an ID.
|
void |
store(String id,
InputStream stream)
Stores an input stream that will be referenced with an ID.
|
public static final char SEPARATOR_CHAR
public boolean exists(String id) throws IOException
Storage
exists
in interface Storage
id
- the storage-key to check.true
if the given ID exists, false
otherwiseIOException
- if an I/O error occurs.public String[] getIds() throws IOException
Storage
getIds
in interface Storage
IOException
- if an I/O error occurs.public InputStream load(String id) throws IOException
Storage
null
if there is none.load
in interface Storage
id
- the ID of the data to be returned.null
.IOException
- if an I/O error occurs.public void move(String src, String dst) throws IOException
Storage
If a data is already stored with the new ID, it is overwritten.
move
in interface Storage
src
- the old ID of the data.dst
- the new ID of the data.IOException
- if an I/O error occurs.public void remove(String id) throws IOException
Storage
remove
in interface Storage
id
- the ID of the data to return.IOException
- if an I/O error occurs.public void store(String id, InputStream stream) throws IOException
Storage
If a data is already stored with this ID, it is overwritten.
store
in interface Storage
id
- the ID of the stored data.stream
- the data to be stored.IOException
- if an I/O error occurs.