From 85e574618b04a34d5e41444d17ce7e6d5a93cc5b Mon Sep 17 00:00:00 2001 From: netconomy Date: Thu, 6 Sep 2007 12:18:45 +0000 Subject: =?UTF-8?q?Streaming=20R=C3=BCckbau?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@210 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../pdfas/impl/input/FileBasedTextDataSourceImpl.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java') diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java index 6f6c7b4..1988519 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java @@ -13,6 +13,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import at.gv.egiz.pdfas.framework.input.TextDataSource; +import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper; /** * @author wprinz @@ -121,4 +122,21 @@ public class FileBasedTextDataSourceImpl implements TextDataSource, FileBased return (int) getFile().length(); } + byte [] cache = null; + + /** + * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray() + */ + public byte[] getAsByteArray() + { + if (cache != null) + { + return cache; + } + + cache = DataSourceHelper.convertInputStreamToByteArray(createInputStream()); + + return cache; + } + } -- cgit v1.2.3