Package org.forgerock.openig.text
Class SeparatedValuesFile
java.lang.Object
org.forgerock.openig.text.SeparatedValuesFile
Allows records to be retrieved from a delimiter-separated file using key and value. Once
constructed, an instance of this class is thread-safe, meaning the object can be long-lived,
and multiple concurrent calls to
getRecord is fully
supported.-
Constructor Summary
ConstructorsConstructorDescriptionSeparatedValuesFile(File file, Charset charset, Separator separator, boolean header) Builds a new SeparatedValuesFile reading the givenfile. -
Method Summary
Modifier and TypeMethodDescriptionReturns a record from the file where the specified key is equal to the specified value.voidSet the explicit field keys in the order they appear in a record, overriding any existing field header, or empty to use field header.
-
Constructor Details
-
SeparatedValuesFile
Builds a new SeparatedValuesFile reading the givenfile.- Parameters:
file- file to read fromcharset-Charsetof the file (non-null)separator- separator specificationheader- does the file has a header first line ?
-
-
Method Details
-
setFields
Set the explicit field keys in the order they appear in a record, overriding any existing field header, or empty to use field header.- Parameters:
fields- the fields to set.
-
getRecord
Returns a record from the file where the specified key is equal to the specified value.- Parameters:
key- the key to use to lookup the recordvalue- the value that the key should have to find a matching record.- Returns:
- the record with the matching value, or
nullif no such record could be found. - Throws:
IOException- if an I/O exception occurs.
-