public class RecordListReader
extends java.lang.Object
A record is a sequence of lines, where the first line is the string "START
<recordtype>
" and the last line is the string "END <recordtype>
" where <recordtype>
is specified by the client. For example:
START person ... arbitrary text ... ... more arbitrary text ... END personAny lines within and between records, that are only whitespace or start with "#", are skipped.
This class's built-in functionality extracts records from a file. It then parses and processes each record, using the RecordProcessor provided by the client. .
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
endMarker
The value of endMarker is "END recordType"
|
private RecordProcessor |
processor
The object in charge of doing whatever is to be done with the record.
|
private java.lang.String |
startMarker
The value of startMarker is "START recordType"
|
Constructor and Description |
---|
RecordListReader(java.lang.String recordType,
RecordProcessor proc) |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
nextNWCLine(java.io.BufferedReader reader) |
void |
parse(java.io.BufferedReader reader) |
void |
parse(java.nio.file.Path inFile) |
void |
parse(java.lang.String inFile) |
private java.util.List<java.lang.String> |
readOneRecord(java.io.BufferedReader reader) |
private final java.lang.String startMarker
private final java.lang.String endMarker
private final RecordProcessor processor
public RecordListReader(java.lang.String recordType, RecordProcessor proc)
public void parse(java.lang.String inFile)
public void parse(java.nio.file.Path inFile)
public void parse(java.io.BufferedReader reader)
private java.util.List<java.lang.String> readOneRecord(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException
private static java.lang.String nextNWCLine(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException