[ 
https://issues.apache.org/jira/browse/PDFBOX-4554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16850990#comment-16850990
 ] 

Tilman Hausherr commented on PDFBOX-4554:
-----------------------------------------

I still don't get it. Where is this {{arraycopy}}? You wrote:
{quote}Every operation that cannot take an offset and length require:
{code:java}
byte[] data=new byte[baseTargetLength];
System.arraycopy(baseData, baseOffset, data, 0, baseTargetLength);
{code}
{quote}
where is this code? The {{ByteArrayInputStream}} constructor without 
offset/length is in jdk 1.8:
{code:java}
public ByteArrayInputStream(byte buf[]) {
    this.buf = buf;
    this.pos = 0;
    this.count = buf.length;
}
{code}
So I don't see what your change would improve. {{ByteArrayInputStream}} calls 
arraycopy once, but only when reading into a byte array, which makes sense.

Or is it that your own application has its PDF in a segment of a byte array? In 
that case, it would be easier if you create a "special" ByteArrayInputStream 
yourself and pass that one to the {{getSignedContent(InputStream)}} method.


> 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]

Reply via email to