public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static ArchiveFactory |
getArchiveFactory() |
static ArchivistFactory |
getArchivistFactory() |
static URI |
getURI(File f) |
static URI |
getURI(String s) |
static String |
replaceTokens(String s,
Properties values)
Searches for placeholders of the form ${token-name} in the input String, retrieves
the property with name token-name from the Properties object, and (if
found) replaces the token in the input string with the property value.
|
static String |
toXMLEscaped(String content) |
static File |
verifyFilePath(String filePath)
Returns a File for the specified path if the file exists and is readable.
|
static File |
writeTextToTempFile(String content,
String prefix,
String suffix,
boolean retainTempFiles)
Writes the provided text to a temporary file marked for deletion on exit.
|
public static File verifyFilePath(String filePath) throws FileNotFoundException, IOException
filePath
- FileNotFoundException
IOException
public static ArchiveFactory getArchiveFactory()
public static ArchivistFactory getArchivistFactory()
public static URI getURI(String s) throws URISyntaxException
URISyntaxException
public static URI getURI(File f) throws URISyntaxException
URISyntaxException
public static File writeTextToTempFile(String content, String prefix, String suffix, boolean retainTempFiles) throws IOException, FileNotFoundException
content
- the content to be writtenprefix
- for the temp file, conforming to the File.createTempFile requirementssuffix
- for the temp fileIOException
- for any errors writing the temporary fileFileNotFoundException
- if the temp file cannot be opened for any reasonpublic static String replaceTokens(String s, Properties values)
s
- String possibly containing tokensvalues
- Properties object containing name/value pairs for substitutionCopyright © 2019. All rights reserved.