Class FileMap
java.lang.Object
org.moeaframework.analysis.store.fs.FileMap
- All Implemented Interfaces:
Defined
- Direct Known Subclasses:
HashFileMap
,HierarchicalFileMap
Defines how containers and blobs are mapped to paths on a file system.
Since arbitrary names can be used, certain characters are escaped:
- Invalid or reserved characters are escaped by their hex value (e.g.,
"/"
becomes"%2F"
). This also includes whitespace characters. - The character
"%"
, if not being used to escape a value, is represented by"%%"
. - If a filename starts with
"."
or"~"
, this prefix is escaped. This serves two purposes. First, it prevents interpreting the file name as a relative path. Second, it reserves the use of hidden files.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.moeaframework.core.Defined
Defined.ConstructorComparator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Path
escapePath
(String filename) Returns a file system-safe path for the give file name.Returns the path to the blob associated with the given reference and name.void
updateManifest
(Manifest manifest) Updates the manifest with information about this file map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.Defined
getDefinition
-
Constructor Details
-
FileMap
public FileMap()Constructs a file map.
-
-
Method Details
-
mapBlob
Returns the path to the blob associated with the given reference and name. The default implementation places the blobs directly inside the container mapped bymapContainer(Schema, Path, Reference)
.- Parameters:
schema
- the schema defining the structureroot
- the root directoryreference
- the container referencename
- the blob name- Returns:
- the blob path
- Throws:
IOException
- if an I/O error occurred
-
updateManifest
Updates the manifest with information about this file map.- Parameters:
manifest
- the manifest
-
escapePath
Returns a file system-safe path for the give file name.- Parameters:
filename
- the file name- Returns:
- the file system-safe path
-