Class FileStringLookup
java.lang.Object
org.apache.commons.text.lookup.AbstractStringLookup
org.apache.commons.text.lookup.AbstractPathFencedLookup
org.apache.commons.text.lookup.FileStringLookup
- All Implemented Interfaces:
Function<String,String>, UnaryOperator<String>, StringLookup
Looks up file contents.
Using a StringLookup from the StringLookupFactory:
StringLookupFactory.INSTANCE.fileStringLookup().lookup("UTF-8:com/domain/document.properties");
The above example converts "UTF-8:com/domain/document.properties" to the UTF-8 contents of the file at com/domain/document.properties.
Using a StringSubstitutor:
StringSubstitutor.createInterpolator().replace("... ${file:UTF-8:com/domain/document.properties} ..."));
The above example converts "UTF-8:SomePath" to the UTF-8 contents of the file at SomePath.
Public access is through StringLookupFactory.
- Since:
- 1.5
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final AbstractStringLookupDefines the singleton for this class.Fields inherited from class AbstractPathFencedLookup
fenceFields inherited from class AbstractStringLookup
SPLIT_CH, SPLIT_STR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractPathFencedLookup
getPathMethods inherited from class AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKeyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StringLookup
apply
-
Field Details
-
INSTANCE
Defines the singleton for this class.
-
-
Constructor Details
-
FileStringLookup
FileStringLookup(Path... fences) Constructs a new instance.- Parameters:
fences- The fences guarding Path resolution.
-
-
Method Details
-
lookup
-