Hi Mark,
thank you for your response.
You are right, the current implementation uses byte[] and it's not so easy
to refactor using streams instead.
I've some concern because if we need to process more than a file at the same
time we can have OutOfMemoryError for smaller files.
I'll add a issue to the iText tracker hoping for a future implementation.
Thanks
Stefano
2010/11/18 Mark Storer <msto...@autonomy.com>
> I don't think so, but that's a good idea. Let me see... Ouch. We'd
> need to decompress and optionally decrypt the bytes on the fly as they were
> read. Not a quick fix by any stretch.
>
> What happens internally, is that we call getStreamBytesRaw, which returns
> the compressed, decrypted bytes. Those bytes are then fed into decodeBytes,
> and that output is returned from getStreamBytes().
>
> The peak usage is looking like "bytes in the file" + "decompressed bytes"
> (200mb in your case). If there's crypto involved, you'll have two byte
> arrays of "bytes in the file" length. I'd expect the GC to get rid of the
> encrypted bytes during the hunt for the 200mb byte array.
>
>
> There's an OutputStreamEncryption for writing data to be encrypted, but I
> don't see a cooresponding InputStreamEncryption. Nope... and the
> decompression code is all byte-based.
>
>
> --Mark Storer
> Senior Software Engineer
> Cardiff.com
>
> import legalese.Disclaimer;
> Disclaimer<Cardiff> DisCard = null;
>
>
>
> ------------------------------
> *From:* stefano fontanel [mailto:stefano.fonta...@gmail.com]
> *Sent:* Thursday, November 18, 2010 6:47 AM
> *To:* itext-questions@lists.sourceforge.net
> *Subject:* [iText-questions] OutOfMemoryError extracting large
> sizedattachment from a pdf
>
> Hi all,
> I'm trying to extract an attachment from a pdf file (previously created
> with itext). I used the code of extractDocLevelAttachments() method as
> suggested at page http://itextpdf.com/examples/iia.php?id=290.
> It works for "normal sized" attachments. When I try to extract "large
> sized" files (e.g. more than 200 MB) i receive a java.lang.OutOfMemoryError.
> I think the trouble is on method PdfReader.getStreamBytes(..) which returns
> a byte[]. I know i can increase JVM size but i would like to know if there
> is an alternative to receive something like an InputStream with itext api..
> I'm using itext 5.0.4.
> Thanks in advance.
>
> Stefano
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php