public class StorageFs
extends java.lang.Object
implements ej.storage.Storage
| Constructor and Description |
|---|
StorageFs()
Creates a storage on file system.
|
StorageFs(java.lang.String root)
Creates a storage on file system specifying the root folder where the files will be created.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.OutputStream |
append(java.lang.String id) |
boolean |
exists(java.lang.String id) |
protected java.io.File |
getFile(java.lang.String id)
Returns the file associated to the given storage id.
|
java.lang.String[] |
getIds() |
protected static java.lang.String |
getRootFolderPropertyOrDefault()
Gets the root folder set with
ej.storage.fs.StorageFs.root or if none. |
long |
getSize(java.lang.String id) |
java.io.InputStream |
load(java.lang.String id) |
java.io.OutputStream |
modify(java.lang.String id,
int offset) |
void |
move(java.lang.String sourceId,
java.lang.String destinationId) |
void |
remove(java.lang.String id) |
java.io.OutputStream |
store(java.lang.String id) |
public StorageFs()
throws java.io.IOException
The root folder where the files will be created can be specified with the property
ej.storage.fs.StorageFs.root. If not set, will be used.
java.io.IOException - if the specified root already exists and is not a directory.java.io.IOException - if the specified root cannot be created.public StorageFs(java.lang.String root)
throws java.io.IOException
root - the root.java.io.IOException - if the specified root already exists and is not a directory.java.io.IOException - if the specified root cannot be created.protected static java.lang.String getRootFolderPropertyOrDefault()
ej.storage.fs.StorageFs.root or if none.public java.io.OutputStream store(java.lang.String id)
throws java.io.IOException
store in interface ej.storage.Storagejava.io.IOExceptionpublic java.io.OutputStream modify(java.lang.String id,
int offset)
throws java.io.IOException
modify in interface ej.storage.Storagejava.io.IOExceptionprotected java.io.File getFile(java.lang.String id)
id - the storage identifier.public java.io.OutputStream append(java.lang.String id)
throws java.io.IOException
append in interface ej.storage.Storagejava.io.IOException@Nullable
public java.io.InputStream load(java.lang.String id)
throws java.io.IOException
load in interface ej.storage.Storagejava.io.IOExceptionpublic void move(java.lang.String sourceId,
java.lang.String destinationId)
throws java.io.IOException
move in interface ej.storage.Storagejava.io.IOExceptionpublic void remove(java.lang.String id)
throws java.io.IOException
remove in interface ej.storage.Storagejava.io.IOExceptionpublic long getSize(java.lang.String id)
throws java.io.IOException
getSize in interface ej.storage.Storagejava.io.IOExceptionpublic boolean exists(java.lang.String id)
throws java.io.IOException
exists in interface ej.storage.Storagejava.io.IOExceptionpublic java.lang.String[] getIds()
throws java.io.IOException
getIds in interface ej.storage.Storagejava.io.IOException