aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
diff options
context:
space:
mode:
authornetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-09-06 12:18:45 +0000
committernetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-09-06 12:18:45 +0000
commit85e574618b04a34d5e41444d17ce7e6d5a93cc5b (patch)
tree1720e8a11493b8175a927e7462687f8ec6848609 /src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
parent148948fa82b26a78b5c2b7d0a79777474b64e581 (diff)
downloadpdf-as-3-85e574618b04a34d5e41444d17ce7e6d5a93cc5b.tar.gz
pdf-as-3-85e574618b04a34d5e41444d17ce7e6d5a93cc5b.tar.bz2
pdf-as-3-85e574618b04a34d5e41444d17ce7e6d5a93cc5b.zip
Streaming Rückbau
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@210 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
index 0d27781..e4a5649 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/ByteArrayPdfDataSourceImpl.java
@@ -23,34 +23,43 @@ public class ByteArrayPdfDataSourceImpl implements PdfDataSource
{
protected byte[] pdf = null;
- protected int length = -1;
-
public ByteArrayPdfDataSourceImpl(byte[] pdf)
{
PerformanceCounters.byteArrays.increment();
this.pdf = pdf;
- this.length = pdf.length;
}
public ByteArrayPdfDataSourceImpl(byte[] pdf, int length)
{
PerformanceCounters.byteArrays.increment();
- this.pdf = pdf;
- this.length = length;
+ if (pdf.length == length)
+ {
+ this.pdf = pdf;
+ }
+ else
+ {
+ this.pdf = new byte [length];
+ System.arraycopy(pdf, 0, this.pdf, 0, length);
+ }
}
public InputStream createInputStream()
{
- ByteArrayInputStream bais = new ByteArrayInputStream(this.pdf, 0, this.length);
+ ByteArrayInputStream bais = new ByteArrayInputStream(this.pdf);
return bais;
}
public int getLength()
{
- return this.length;
+ return this.pdf.length;
}
+ public byte[] getAsByteArray()
+ {
+ return this.pdf;
+ }
+
}