package org.xbib.datastructures.xslx;

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.IOException;

abstract public class ReaderSupport {

	public final static int TYPE_XLS = 1;
	public final static int TYPE_XLSX = 2;

	abstract public void setInputFile(File file);

	abstract public void open();

	abstract public ExcelRowIterator rowIterator() throws XMLStreamException, IOException;

	abstract public void close();

	public static ReaderSupport newInstance(int type, File f) {
		ReaderSupport support = null;
		if (type == TYPE_XLSX)
			support = new XLSXReaderSupport();
		else
			support = new XLSReaderSupport();
		support.setInputFile(f);
		return support;
	}

}
