Class FileStorageImpl
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.filestorage.impl.FileStorageImpl
-
public class FileStorageImpl extends Object
The default implementation ofFileStorage.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE_STORAGE_NAMESPACES_PROPERTIESThe name of the file in the base directory that holds the namespace map.static StringFILE_STORAGE_ROOTThe name of the root directory, within the base directory.static intSHORTY_LENGTHHow often to we insert path separator characters?
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateFile(String id, String filename, InputStream bytes)Before creating the file, we may need to create one or more parent directories to put it in.booleandeleteFile(String id)If deleting this file leaves its parent directory empty, that directory will be deleted.StringgetFilename(String id)For a non-null result, a directory must exist for the ID, and it must contain a file (it may or may not contain other directories).InputStreamgetInputStream(String id, String filename)
-
-
-
Field Detail
-
FILE_STORAGE_ROOT
public static final String FILE_STORAGE_ROOT
The name of the root directory, within the base directory.- See Also:
- Constant Field Values
-
FILE_STORAGE_NAMESPACES_PROPERTIES
public static final String FILE_STORAGE_NAMESPACES_PROPERTIES
The name of the file in the base directory that holds the namespace map.- See Also:
- Constant Field Values
-
SHORTY_LENGTH
public static final int SHORTY_LENGTH
How often to we insert path separator characters?- See Also:
- Constant Field Values
-
-
Method Detail
-
createFile
public void createFile(String id, String filename, InputStream bytes) throws FileAlreadyExistsException, IOException
Before creating the file, we may need to create one or more parent directories to put it in.
-
deleteFile
public boolean deleteFile(String id) throws IOException
If deleting this file leaves its parent directory empty, that directory will be deleted. This repeats, up to (but not including) the root directory.
- Throws:
IOException
-
getFilename
public String getFilename(String id)
For a non-null result, a directory must exist for the ID, and it must contain a file (it may or may not contain other directories).
-
getInputStream
public InputStream getInputStream(String id, String filename) throws IOException
- Throws:
IOException
-
-