Class PathBuilder
- java.lang.Object
-
- org.hl7.fhir.utilities.PathBuilder
-
public class PathBuilder extends Object
-
-
Constructor Summary
Constructors Constructor Description PathBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbuildPath(String... args)Builds a path from the passed argument strings.static PathBuildergetPathBuilder()Returns an instance of PathBuilder with all checks enabled (recommended).protected static booleanhasCTempDir()protected static booleanisPathRoot(String pathString)
-
-
-
Constructor Detail
-
PathBuilder
public PathBuilder()
-
-
Method Detail
-
getPathBuilder
public static PathBuilder getPathBuilder()
Returns an instance of PathBuilder with all checks enabled (recommended).- Returns:
-
buildPath
public String buildPath(String... args) throws IOException
Builds a path from the passed argument strings. This path will be compatible with the local filesystem.
If the args contain variables enclosed in square brackets (
[ ]), they will be replaced with values in the built path. There are several built-in variables available, listed below. Any text between square brackets that does not match these will be replaced by a matching System environment variable if one is available.Built-in variables include:
- [tmp] An available temp directory (Java Temp directory,
c:\\temp, $TMPDIR, %TEMP%, etc.) - [user] The OS user directory (~, user.home, etc)
This method will run several checks by default to ensure that the built path does not point to unintended areas of the filesystem. If these checks are violated, a RuntimeException will be thrown. If needed in special cases, the behavior of these checks can be modified via the linked fluent constructor methods below.
- Parameters:
args- entries with which to construct the filesystem path- Returns:
- a local filesystem path
- Throws:
RuntimeExceptionIOException
- [tmp] An available temp directory (Java Temp directory,
-
hasCTempDir
protected static boolean hasCTempDir() throws IOException
- Throws:
IOException
-
isPathRoot
protected static boolean isPathRoot(String pathString)
-
-