xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harshini Madurapperuma <harshini.madurapper...@ifs.lk>
Subject RE: Convert InputSource into a Character array
Date Thu, 05 Apr 2007 03:17:56 GMT
Hi;

I have this character array, I converted that character array into to a
InputSource and passed it as a parameter to a  "render(XMLReader parser,
InputSource source)" method in the DRIVER class in fop.

Within that "render" class I need to convert that "InputSource (source)"
back into a character array (after doing some modifications inside that
method). I tried to convert that as follows:

> if (source.getCharacterStream() != null) {
> 	BufferedReader reader = new
BufferedReader(source.getCharacterStream());
>       CharArrayWriter writer=new CharArrayWriter();
>       int i=-1;
>       while ((i=reader.read())!=-1)
>           {
>             writer.write(i);
>            }
>            reader.close();
>            writer.close();
>    }

While doing that it raise this Exception:
> EXCEPTION-------------------------------------------------------------
> ------
> ----
> 
> java.io.IOException: Stream closed         at
> java.io.CharArrayReader.ensureOpen(CharArrayReader.java:65)         at
> java.io.CharArrayReader.read(CharArrayReader.java:95)         at
> java.io.BufferedReader.fill(BufferedReader.java:136)         at
> java.io.BufferedReader.read(BufferedReader.java:157)         at
> org.apache.fop.apps.Driver.render(Driver.java:557)
> ----------------------------------------------------------------------

I need to know the reason or is there any other method to convert this and
access the content of this inputSource?

Thanx
Harshini



-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Thursday, April 05, 2007 12:11 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Convert InputSource into a Character array

I don't understand what you're trying to do. Maybe you should explain that
before going into technical details.

On 04.04.2007 06:08:53 Harshini Madurapperuma wrote:
> Hi All;
> 
> In fop Driver class there is a method called
>   
> public synchronized void render(XMLReader parser, InputSource source)
>                 throws FOPException {
> 	
> 	}
> 
> Is there a way to convert that InputSource "source" back into a 
> character array within that render class? I tried to do it by this way 
> but it throws a "Stream Closed" Exception.
> ----------------------------------------------------------------------
> ------
> --
> if (source.getCharacterStream() != null) {
> 	BufferedReader reader = new
> BufferedReader(source.getCharacterStream());
>       CharArrayWriter writer=new CharArrayWriter();
>       int i=-1;
>       while ((i=reader.read())!=-1)
>           {
>             writer.write(i);
>            }
>            reader.close();
>            writer.close();
>    }
> ----------------------------------------------------------------------
> ------
> ----
> EXCEPTION-------------------------------------------------------------
> ------
> ----
> 
> java.io.IOException: Stream closed         at
> java.io.CharArrayReader.ensureOpen(CharArrayReader.java:65)         at
> java.io.CharArrayReader.read(CharArrayReader.java:95)         at
> java.io.BufferedReader.fill(BufferedReader.java:136)         at
> java.io.BufferedReader.read(BufferedReader.java:157)         at
> org.apache.fop.apps.Driver.render(Driver.java:557)
> ----------------------------------------------------------------------
> ------
> -----
>   
> I'm using java as the language. Pls ur help will be greatly 
> appreciated Thanx Harshini.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message