[
https://issues.apache.org/jira/browse/PDFBOX-4554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16851290#comment-16851290
]
Jason Pyeron commented on PDFBOX-4554:
--------------------------------------
Answer question 2 first:
Looking at commit: 5dfe48807617da320b1d64cbf4fa88ca84e0ca82
Line 115 of
./pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBufferedFileInputStream.java
from 143 of
./examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
if the input was not a File but a byte[] or InputStream.
But this is why we use:
public class ByteBufferRandomAccessReader extends ByteArrayInputStream
implements RandomAccessRead ...
Now question 1:
We continue with our diskless ShowSignature
private void showSignature(String password, byte[] buffer, int offset, int
length) throws IOException,
GeneralSecurityException,
TSPException,
CertificateVerificationException
and after line 289 we call it recursively as
showSignature(password, buffer, offset+byteRange[0], (int) (byteRange[2] +
(long) byteRange[3]));
I hope this helps you, because I have about 150k byte[] averaging 4M each,
containing minimum 6 pdf versions. I have made the patch, I asked for feedback
on the patch, if you have feedback on the pull request (e.g. formatting,
nmeing, etc.) I am happy to adjust it. We have deployed the patch in to
production already here.
> operations taking a byte[] need to allow for offset and length too
> ------------------------------------------------------------------
>
> Key: PDFBOX-4554
> URL: https://issues.apache.org/jira/browse/PDFBOX-4554
> Project: PDFBox
> Issue Type: Improvement
> Reporter: Jason Pyeron
> Priority: Major
>
> Without this, massive amounts of memory must be copied/allocated to "trim"
> byte[].
> See forthcoming pull request.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]