public class FileStorageImpl extends Object
FileStorage.| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_STORAGE_NAMESPACES_PROPERTIES
The name of the file in the base directory that holds the namespace map.
|
static String |
FILE_STORAGE_ROOT
The name of the root directory, within the base directory.
|
static int |
SHORTY_LENGTH
How often to we insert path separator characters?
|
| Modifier and Type | Method and Description |
|---|---|
void |
createFile(String id,
String filename,
InputStream bytes)
Before creating the file, we may need to create one or more parent
directories to put it in.
|
boolean |
deleteFile(String id)
If deleting this file leaves its parent directory empty, that directory
will be deleted.
|
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).
|
InputStream |
getInputStream(String id,
String filename) |
public static final String FILE_STORAGE_ROOT
public static final String FILE_STORAGE_NAMESPACES_PROPERTIES
public static final int SHORTY_LENGTH
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.
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.
IOExceptionpublic 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).
public InputStream getInputStream(String id, String filename) throws IOException
IOExceptionCopyright © 2022. All rights reserved.