Package com.microej.kf.util.storage
Class SandboxedStorage
- java.lang.Object
-
- com.microej.kf.util.storage.SandboxedStorage
-
- All Implemented Interfaces:
ej.storage.Storage
public class SandboxedStorage extends java.lang.Object implements ej.storage.StorageExtends the storage on file system to add sandboxing for the applications.
-
-
Constructor Summary
Constructors Constructor Description SandboxedStorage()Creates a sandboxed storage on file system.SandboxedStorage(java.lang.String root)Creates a storage on file system specifying the root folder where the root folder will be created.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.OutputStreamappend(java.lang.String s)booleanexists(java.lang.String s)java.lang.String[]getIds()java.lang.StringgetRootFolder(ej.kf.Module module)Gets the root folder of the storage service for a given module.longgetSize(java.lang.String s)java.io.InputStreamload(java.lang.String s)java.io.OutputStreammodify(java.lang.String s, int i)voidmove(java.lang.String s, java.lang.String s1)voidremove(java.lang.String s)java.io.OutputStreamstore(java.lang.String s)
-
-
-
Constructor Detail
-
SandboxedStorage
public SandboxedStorage() throws java.io.IOExceptionCreates a sandboxed storage on file system.The root folder is determined dynamically depending on the KF context. Each module has a different one.
- Throws:
java.io.IOException- if the root cannot be created.- See Also:
Kernel.getContextOwner(),StorageFs()
-
SandboxedStorage
public SandboxedStorage(java.lang.String root) throws java.io.IOExceptionCreates a storage on file system specifying the root folder where the root folder will be created.The root folder is determined dynamically depending on the KF context. Each module has a different one.
- Parameters:
root- the root folder.- Throws:
java.lang.IllegalArgumentException- if the root already exists and is not a directory.java.io.IOException- if the root cannot be created.
-
-
Method Detail
-
getRootFolder
public java.lang.String getRootFolder(ej.kf.Module module)
Gets the root folder of the storage service for a given module.- Parameters:
module- the module.- Returns:
- the root folder.
-
store
public java.io.OutputStream store(java.lang.String s) throws java.io.IOException- Specified by:
storein interfaceej.storage.Storage- Throws:
java.io.IOException
-
modify
public java.io.OutputStream modify(java.lang.String s, int i) throws java.io.IOException- Specified by:
modifyin interfaceej.storage.Storage- Throws:
java.io.IOException
-
append
public java.io.OutputStream append(java.lang.String s) throws java.io.IOException- Specified by:
appendin interfaceej.storage.Storage- Throws:
java.io.IOException
-
load
public java.io.InputStream load(java.lang.String s) throws java.io.IOException- Specified by:
loadin interfaceej.storage.Storage- Throws:
java.io.IOException
-
move
public void move(java.lang.String s, java.lang.String s1) throws java.io.IOException- Specified by:
movein interfaceej.storage.Storage- Throws:
java.io.IOException
-
remove
public void remove(java.lang.String s) throws java.io.IOException- Specified by:
removein interfaceej.storage.Storage- Throws:
java.io.IOException
-
getSize
public long getSize(java.lang.String s) throws java.io.IOException- Specified by:
getSizein interfaceej.storage.Storage- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String s) throws java.io.IOException- Specified by:
existsin interfaceej.storage.Storage- Throws:
java.io.IOException
-
getIds
public java.lang.String[] getIds() throws java.io.IOException- Specified by:
getIdsin interfaceej.storage.Storage- Throws:
java.io.IOException
-
-