Closing a ByteArrayOutputStream does nothing.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Denis COCHET
> Sent: Monday, June 02, 2008 3:05 PM
> To: [email protected]
> Subject: [iText-questions] Method InputStreamToArray
> fromRAndomAccessFileOrArray
>
> After a long time debugging and having "out of memory errors"
> (java heap space), I was answered why the
> ByteArrayOutputStream is not closed ?
>
>
>
> public static byte[] InputStreamToArray(InputStream is)
> throws IOException {
>
> byte b[] = new byte[8192];
>
> ByteArrayOutputStream out = new ByteArrayOutputStream();
>
> while (true) {
>
> int read = is.read(b);
>
> if (read < 1)
>
> break;
>
> out.write(b, 0, read);
>
> }
>
> Return out.toByteArray();
>
> }
>
>
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar