package info.bukova.isspst.services.fulltext;

import org.apache.poi.POIXMLTextExtractor;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author Pepa Rokos
 */
public abstract class AbstractOfficeExtractor extends AbstractExtractor {

	@Override
	public String extract(InputStream is) throws ExtractorException {
		try {
			POIXMLTextExtractor extractor = createExtractor(is);
			return extractor.getText();
		} catch (IOException e) {
			throw new ExtractorException(e);
		}
	}

	protected abstract POIXMLTextExtractor createExtractor(InputStream is) throws IOException;

}
