/** * */ package at.gv.egiz.pdfas.framework.input; import java.io.InputStream; /** * The input document data source. * *

* Usually this is a PdfDataSource, but it may be a TextDataSource as well. *

* * @author wprinz * */ public interface DataSource { /** * Creates a new InputStream that allows to read out the document's binary * data from the beginning. * * @return Returns the InputStream with the binary data. */ public InputStream createInputStream(); /** * Returns the length (number of bytes) of the stream. * * @return Returns the length (number of bytes) of the stream. */ public int getLength(); /** * Returns the data of this DataSource as a byte array. * *

* Calling this method indicates that you need a byte array for random read access. * The DataSource implementation should of course cache this byte array to avoid too much memory usage. *

*

* Performance analysis has shown that the libraries internally convert the streams to byte arrays and * that file system access is very slow. *

* * @return */ public byte [] getAsByteArray(); }