public class FileStorageHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
HEX_ENCODE_SOURCES |
static char |
HEX_ESCAPE_CHAR |
static char[] |
NAME_SINGLE_CHARACTER_SOURCES
Same as for path, except that a period is not translated.
|
static char[] |
NAME_SINGLE_CHARACTER_TARGETS
Same as for path, except that a period is not translated.
|
static char[] |
PATH_SINGLE_CHARACTER_SOURCES |
static char[] |
PATH_SINGLE_CHARACTER_TARGETS |
static String[] |
WINDOWS_RESERVED_NAMES
Windows reserves these names (case-insensitive), so they can't be used
for directories or files.
|
| Constructor and Description |
|---|
FileStorageHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
decodeName(String stored)
Restore the filename to its original form, removing the encoding.
|
static String |
encodeName(String filename)
Encode the filename as needed to guard against illegal characters.
|
static File |
getFullPath(File rootDir,
String id,
String filename,
Map<Character,String> namespacesMap)
Translate the object ID, the file storage root directory and the filename
into a full path to where the file would be stored.
|
static File |
getPathToIdDirectory(String id,
Map<Character,String> namespacesMap,
File rootDir)
Translate the object ID and the file storage root directory into a full
path to the directory that would represent that ID.
|
static String |
id2Path(String id,
Map<Character,String> namespacesMap)
Translate the object ID to a relative directory path.
|
public static final char HEX_ESCAPE_CHAR
public static final String HEX_ENCODE_SOURCES
public static final char[] PATH_SINGLE_CHARACTER_SOURCES
public static final char[] PATH_SINGLE_CHARACTER_TARGETS
public static final char[] NAME_SINGLE_CHARACTER_SOURCES
public static final char[] NAME_SINGLE_CHARACTER_TARGETS
public static final String[] WINDOWS_RESERVED_NAMES
public static String encodeName(String filename)
public static String decodeName(String stored)
public static String id2Path(String id, Map<Character,String> namespacesMap)
public static File getPathToIdDirectory(String id, Map<Character,String> namespacesMap, File rootDir)
Copyright © 2016. All rights reserved.