473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting the content of InputSource!! Need Help!!

18
Hi all;

My problem is as follows::

// Class_1 code
------------------------------------------------------------------------
private char[] fo;
CharArrayWriter fos = new CharArrayWriter();
fo =fos.toCharArray();
InputSource foSource = new InputSource(new CharArrayReader(fo));

//This foSource is passed to a method in Class_2 (Driver);
driver.render(xmlReader, foSource);


Class_2 (Driver)code;
---------------------------------------------------------------------------------------
public synchronized void render(XMLReader parser, InputSource source)
throws FOPException {

---------
---------
---------

}


Qn) In render method in Driver class; i want to convert that InputSource "source" back into a char array.
Is it possible to do like that?
Because in Class_1 "fos" content is like this

<fo:root .................................................. ......................................>
<fo:external-graphic left="29mm" top="355mm" width="538mm" height="132mm" src="file:./report_designer_graphics/FNDBAS/FND_SESSION_REP/Error.JPG"/>
</fo:root>

Under render method i want to get this content back by using "source" InputSource by way of a char array of by any other way. Is it possible?

Ur help will be greatly appreciated
Thank
Mar 23 '07 #1
6 4206
r035198x
13,262 8TB
Hi all;

My problem is as follows::

// Class_1 code
------------------------------------------------------------------------
private char[] fo;
CharArrayWriter fos = new CharArrayWriter();
fo =fos.toCharArray();
InputSource foSource = new InputSource(new CharArrayReader(fo));

//This foSource is passed to a method in Class_2 (Driver);
driver.render(xmlReader, foSource);


Class_2 (Driver)code;
---------------------------------------------------------------------------------------
public synchronized void render(XMLReader parser, InputSource source)
throws FOPException {

---------
---------
---------

}


Qn) In render method in Driver class; i want to convert that InputSource "source" back into a char array.
Is it possible to do like that?
Because in Class_1 "fos" content is like this

<fo:root .................................................. ......................................>
<fo:external-graphic left="29mm" top="355mm" width="538mm" height="132mm" src="file:./report_designer_graphics/FNDBAS/FND_SESSION_REP/Error.JPG"/>
</fo:root>

Under render method i want to get this content back by using "source" InputSource by way of a char array of by any other way. Is it possible?

Ur help will be greatly appreciated
Thank
What methods are there in the InputSource class?
Mar 23 '07 #2
madumm
18
The method in InputSource are:

public InputSource (String systemId)
{
setSystemId(systemId);
}

public InputSource (InputStream byteStream)
{
setByteStream(byteStream);
}

public InputSource (Reader characterStream)
{
setCharacterStream(characterStream);
}

public void setPublicId (String publicId)
{
this.publicId = publicId;
}

public String getPublicId ()
{
return publicId;
}

public void setSystemId (String systemId)
{
this.systemId = systemId;
}

public String getSystemId ()
{
return systemId;
}

public void setByteStream (InputStream byteStream)
{
this.byteStream = byteStream;
}

public InputStream getByteStream ()
{
return byteStream;
}

public void setEncoding (String encoding)
{
this.encoding = encoding;
}

public String getEncoding ()
{
return encoding;
}

public void setCharacterStream (Reader characterStream)
{
this.characterStream = characterStream;
}

public Reader getCharacterStream ()
{
return characterStream;
}
Mar 23 '07 #3
r035198x
13,262 8TB
The method in InputSource are:

public InputSource (String systemId)
{
setSystemId(systemId);
}

public InputSource (InputStream byteStream)
{
setByteStream(byteStream);
}

public InputSource (Reader characterStream)
{
setCharacterStream(characterStream);
}

public void setPublicId (String publicId)
{
this.publicId = publicId;
}

public String getPublicId ()
{
return publicId;
}

public void setSystemId (String systemId)
{
this.systemId = systemId;
}

public String getSystemId ()
{
return systemId;
}

public void setByteStream (InputStream byteStream)
{
this.byteStream = byteStream;
}

public InputStream getByteStream ()
{
return byteStream;
}

public void setEncoding (String encoding)
{
this.encoding = encoding;
}

public String getEncoding ()
{
return encoding;
}

public void setCharacterStream (Reader characterStream)
{
this.characterStream = characterStream;
}

public Reader getCharacterStream ()
{
return characterStream;
}
The getCharacterStream method seems your best option to get the array from
Mar 23 '07 #4
madumm
18
But i tried that too; i encounterd this problem while doing

if (source.getCharacterStream( ) != null) {
br = new BufferedReader(source.getCharacterStream( ));
br.read(buffer_2, start_2, length_2);

This is giving a:::

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.read1(BufferedReader.java:1 85)

at java.io.BufferedReader.read(BufferedReader.java:26 1)
Mar 23 '07 #5
r035198x
13,262 8TB
But i tried that too; i encounterd this problem while doing

if (source.getCharacterStream( ) != null) {
br = new BufferedReader(source.getCharacterStream( ));
br.read(buffer_2, start_2, length_2);

This is giving a:::

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.read1(BufferedReader.java:1 85)

at java.io.BufferedReader.read(BufferedReader.java:26 1)
I'm sure the exception is explaining itself well here.
Mar 23 '07 #6
madumm
18
The getCharacterStream method seems your best option to get the array from

I didn't get what u r saying
Mar 26 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
4
by: Learner | last post by:
Hello, Here is a little bit of what I am working ... I have selected Header and Side lay out for my Master Page. All my links go on the Side and the content on to the right pane. I have no...
0
by: ameshkin | last post by:
Hi, Im pretty new at PHP and need help with something very simple. I wrote a function which watermarks an image. The function works, but i can't figure out how to output the image into a file. ...
0
by: madumm | last post by:
Hi all; Anybody know how to convert an InputSource into a char array?? need help Thanx
1
crystal2005
by: crystal2005 | last post by:
Hi i encounterd some problem when i implement CSS for rounded Corner table. Need help please... :D <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />...
1
by: kronny20ph | last post by:
I want to know what the real cause of this scrip and how can I resolve this problem. Thank you and Advance. Im not that good in PHP..... Warning: include() : URL file-access is disabled in the...
1
by: Dansmith122 | last post by:
Hi I have been working on the java script for my website and I need help with the out put variables. I need to know how to add more variable for each row in my survey. I am very lost ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.