NKJPWypluwkaFileReader.java 1.09 KB
package ipipan.clarin.tei.impl.io.read;

import ipipan.clarin.tei.api.entities.AnnotationLayer;
import ipipan.clarin.tei.api.entities.TEICorpusText;
import ipipan.clarin.tei.api.entities.TEIParagraph;
import ipipan.clarin.tei.api.exceptions.TEIException;

import java.util.logging.Level;
import java.util.logging.Logger;

import javax.xml.stream.XMLStreamException;

/**
 *
 * @author mlenart
 */
class NKJPWypluwkaFileReader {
	private final InWrapper in;
	private BodyReader bodyReader;

	NKJPWypluwkaFileReader(InWrapper in, AnnotationLayer layer)
			throws TEIException, XMLStreamException {
		this.in = in;
		while (!in.isStart("body"))
			in.next();
		this.bodyReader = BodyReader.create(in, layer);
	}

	void readNextParagraph(TEIParagraph par) throws TEIException,
			XMLStreamException {
		bodyReader.readNextParagraph(par);
	}

	public void readBody(TEICorpusText text) throws TEIException {
		bodyReader.readBody(text);
	}

	void close() {
		try {
			in.close();
		} catch (XMLStreamException ex) {
			Logger.getLogger(NKJPWypluwkaFileReader.class.getName()).log(
					Level.SEVERE, null, ex);
		}
	}
}