Date: Fri, 21 Jun 2013 00:12:31 -0700 (PDT)
From: mkl <m...@wir-sind-cool.org>
Subject: [iText-questions] [SPAM] Re: Application stopped unexpectedly
To: itext-questions@lists.sourceforge.net
Message-ID: <1371798751002-4658576.p...@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii

Joed Cueto,

Joed Cueto wrote
> I have an application that convert an inputSteam to pdf. Below is the
> content of the method that converts input stream to pdf. However, the
> application suddenly stopped on line "*RandomAccessFileOrArray ra = new
> RandomAccessFileOrArray(inputStream);" *without throwing any error or
> exception which is kind of weird. Is it a known bug, can you give some
> solution for this?? Thank you.. Badly needed. Please help

The RandomAccessFileOrArray constructor you use attempts to fully read the
stream in question into a byte[] until the stream signals its end. Then the
constructor initialize its instance with this byte[] and returns only
thereafter. Thus, this constructor is not suited for all kinds of
InputStreams, only for streams with a clear cut end and fast access.

What kind of InputStream do you use?

Regards,   Michael


>>>>>



Hi Michael,

I am using FileInputStream
inputStreamNew = new FileInputStream(tempFile);

This is how the inputStream is generated:

ByteArrayOutputStream baosPDF = null;
 log.debug("start merge tiff.");
 File tempFile = null;
 if (iioimageList != null && iioimageList.size() > 0)
{
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff");
ImageWriter writer = writers.next();

tempFile = File.createTempFile("test", ".tif");
ImageOutputStream ios = ImageIO.createImageOutputStream(tempFile);
writer.setOutput(ios);
IIOImage firstIioImage = iioimageList.remove(0);
writer.write(firstIioImage);
int i = 1;
for (IIOImage iioImage : iioimageList)
{
writer.writeInsert(i++, iioImage, null);
}
ios.close();
}
 InputStream inputStreamNew = null;
 log.info("create new file input stream from file.");
inputStreamNew = new FileInputStream(tempFile);
-- 

Joed G. Cueto
Software Engineer, Java Practice
Business: +632 814 1100
Email: joed.cu...@pointwest.com.ph
Website: www.pointwest.com.ph
Pointwest Technologies Corporation
[image: Pointwest Logo]
12/F Citibank Center, 8741 Paseo de Roxas, Makati City, PH 1226

CONFIDENTIALITY NOTICE: This email may contain confidential and privileged
material for the sole use of the intended recipient(s). Any review, use,
distribution or disclosure by others is strictly prohibited. If you have
received this communication in error, please notify the sender immediately
by e-mail and delete the message and any file attachments from your
computer. There is no warranty that this email is error, virus or defect
free. If this is a private communication it does not represent the views of
Pointwest Technologies Corporation or their related entities.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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

Reply via email to