public class FileStorageImplWrapper extends Object implements FileStorage
Application.Component.LifecycleState| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_STORAGE_SUBDIRECTORY |
static String |
PROPERTY_DEFAULT_NAMESPACE |
| Constructor and Description |
|---|
FileStorageImplWrapper() |
| Modifier and Type | Method and Description |
|---|---|
void |
createFile(String id,
String filename,
InputStream bytes)
Store the bytes from this stream as a file with the specified ID and
filename.
|
boolean |
deleteFile(String id)
If a file exists with this ID, it will be deleted, regardless of the file
name.
|
String |
getFilename(String id)
If a file exists with this ID, get its name.
|
InputStream |
getInputStream(String id,
String filename)
Get a stream that will provide the contents of the file that was stored
with this ID and this filename.
|
void |
shutdown(Application application)
This should be called only once, and should be the last call on this
Component.
|
void |
startup(Application application,
ComponentStartupStatus ss)
Create an instance of FileStorageImpl, based on the values in runtime.properties.
|
public static final String PROPERTY_DEFAULT_NAMESPACE
public static final String FILE_STORAGE_SUBDIRECTORY
public void startup(Application application, ComponentStartupStatus ss)
startup in interface Application.Componentpublic void shutdown(Application application)
Application.Componentshutdown in interface Application.Componentpublic void createFile(String id, String filename, InputStream bytes) throws FileAlreadyExistsException, IOException
FileStoragecreateFile in interface FileStorageFileAlreadyExistsException - if a file already exists with this ID but with a different
filename.IOExceptionpublic String getFilename(String id) throws IOException
FileStoragegetFilename in interface FileStoragenull if it does not.IOExceptionpublic InputStream getInputStream(String id, String filename) throws FileNotFoundException, IOException
FileStoragegetInputStream in interface FileStorageFileNotFoundException - if there is no file that matches this ID and filename.IOExceptionpublic boolean deleteFile(String id) throws IOException
FileStoragedeleteFile in interface FileStoragetrue if a file existed, false otherwise.IOExceptionCopyright © 2016. All rights reserved.