39 lines
874 B
Java
39 lines
874 B
Java
package de.nth.chronicle.gedcom.parser;
|
|
|
|
import de.nth.chronicle.gedcom.Gedcom;
|
|
import de.nth.chronicle.gedcom.exception.GedcomException;
|
|
|
|
import java.io.InputStream;
|
|
import java.util.List;
|
|
|
|
public class GedcomReader {
|
|
|
|
private GedcomReaderContext context;
|
|
private Gedcom result;
|
|
|
|
public GedcomReader() {
|
|
|
|
}
|
|
|
|
public Gedcom read(InputStream stream) throws GedcomException {
|
|
if(this.result != null) return this.result;
|
|
|
|
Tokenizer tokenizer = new Tokenizer(stream);
|
|
List<RecordChunk> chunks = tokenizer.parseRecordsChunks();
|
|
|
|
GedcomReaderContext context = new GedcomReaderContext(chunks);
|
|
Gedcom.GedcomBuilder builder = context.getGedcomBuilder();
|
|
|
|
for(RecordChunk chunk : chunks) {
|
|
|
|
|
|
|
|
}
|
|
|
|
this.result = context.getGedcomBuilder().build();
|
|
return this.result;
|
|
}
|
|
|
|
|
|
}
|