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

Jason Pyeron commented on PDFBOX-4554:
--------------------------------------

again the issue is copying arrays without any need - at all

    public static byte[] toByteArray(final InputStream input) throws 
IOException {
        try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
            copy(input, output);
            return output.toByteArray();
        }
    }

This one patch prevents the code from ever doing a new byte[SIZE]; operation.

We have byte array, at offset and for length we need to parse PDF.

> 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