aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
index f77d6be..4f00bb5 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/CompoundPdfDataSourceImpl.java
@@ -43,5 +43,23 @@ public class CompoundPdfDataSourceImpl implements PdfDataSource
{
return this.originalDataSource.getLength() + this.appendix.length;
}
+
+ byte [] cache = null;
+ /**
+ * @see at.gv.egiz.pdfas.framework.input.DataSource#getAsByteArray()
+ */
+ public byte[] getAsByteArray()
+ {
+ if (cache != null)
+ {
+ return cache;
+ }
+
+ cache = new byte [getLength()];
+ System.arraycopy(originalDataSource.getAsByteArray(), 0, cache, 0, originalDataSource.getLength());
+ System.arraycopy(appendix, 0, cache, originalDataSource.getLength(), appendix.length);
+
+ return cache;
+ }
}