Interface FileStorage
-
- All Superinterfaces:
Application.Component,Application.Module
- All Known Implementing Classes:
FileStorageImplWrapper
public interface FileStorage extends Application.Module
The interface for the File Storage system.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
Application.Component.LifecycleState
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcreateFile(String id, String filename, InputStream bytes)Store the bytes from this stream as a file with the specified ID and filename.booleandeleteFile(String id)If a file exists with this ID, it will be deleted, regardless of the file name.StringgetFilename(String id)If a file exists with this ID, get its name.InputStreamgetInputStream(String id, String filename)Get a stream that will provide the contents of the file that was stored with this ID and this filename.-
Methods inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
shutdown, startup
-
-
-
-
Method Detail
-
createFile
void createFile(String id, String filename, InputStream bytes) throws FileAlreadyExistsException, IOException
Store the bytes from this stream as a file with the specified ID and filename. If the file already exists, it is over-written.- Throws:
FileAlreadyExistsException- if a file already exists with this ID but with a different filename.IOException
-
getFilename
String getFilename(String id) throws IOException
If a file exists with this ID, get its name.- Returns:
- The name of the file (un-encoded) if it exists, or
nullif it does not. - Throws:
IOException
-
getInputStream
InputStream getInputStream(String id, String filename) throws FileNotFoundException, IOException
Get a stream that will provide the contents of the file that was stored with this ID and this filename. Close the stream when you're finished with it.- Throws:
FileNotFoundException- if there is no file that matches this ID and filename.IOException
-
deleteFile
boolean deleteFile(String id) throws IOException
If a file exists with this ID, it will be deleted, regardless of the file name. If no such file exists, no action is taken, no exception is thrown.- Returns:
trueif a file existed,falseotherwise.- Throws:
IOException
-
-