PDA

View Full Version : request for addtnl method on ReportGenerator



Anonymous
08-27-2002, 06:42 AM
hi, can you guys add a constructor in ReportGenerator that accepts inputstream as parameter? its kinda inconvenient to determine the path instead of just taking the xml as inpustream thru getClass.getResourseAsStream()

ie. (com.jrefinery.report.io.ReportGenerator)

ie

public JFreeReport parseReport (InputStream input)
throws ReportDefinitionException, IOException
{
BufferedInputStream bin = new BufferedInputStream (input);
InputSource in = new InputSource (bin);
....

is it possible? whats the disadvantage?

Anonymous
08-27-2002, 08:00 AM
Hi,

sure, it would be possible, but you would have no chance to define or determine the contentbase of the report definition, so you'll get problems when loading external resources (as images f.i.), if the location of those images is given as relative path.

A better way is to write:
URL url = getClass.getResource()

With that you'll get an URL which has an context from where JFreeReport
is able to find the additional resources. This is also working if the resource is loaded from a Jar file or when loading the report using any other URL-based comminication (HTTP, FTP etc).

Have more fun,
said Thomas