net.sf.jasperreports.engine.util
Class JRLoader

java.lang.Object
  extended bynet.sf.jasperreports.engine.util.JRLoader

public class JRLoader
extends java.lang.Object

Version:
$Id: JRLoader.java,v 1.14 2005/10/07 09:27:31 teodord Exp $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Constructor Summary
JRLoader()
           
 
Method Summary
static java.io.InputStream getFileInputStream(java.lang.String filename)
          Tries to open a file for reading.
static java.io.InputStream getLocationInputStream(java.lang.String location)
          Tries to open an input stream for a location.
static java.io.InputStream getResourceInputStream(java.lang.String resource)
          Tries to open an input stream for a resource.
static java.io.InputStream getURLInputStream(java.lang.String spec)
          Tries to open an input stream for an URL.
static byte[] loadBytes(java.io.File file)
           
static byte[] loadBytes(java.io.InputStream is)
           
static byte[] loadBytes(java.net.URL url)
           
static byte[] loadBytesFromLocation(java.lang.String location)
           
static byte[] loadBytesFromLocation(java.lang.String location, java.lang.ClassLoader classLoader)
           
static java.lang.Object loadObject(java.io.File file)
           
static java.lang.Object loadObject(java.io.InputStream is)
           
static java.lang.Object loadObject(java.lang.String fileName)
           
static java.lang.Object loadObject(java.net.URL url)
           
static java.lang.Object loadObjectFromLocation(java.lang.String location)
           
static java.lang.Object loadObjectFromLocation(java.lang.String location, java.lang.ClassLoader classLoader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRLoader

public JRLoader()
Method Detail

loadObject

public static java.lang.Object loadObject(java.lang.String fileName)
                                   throws JRException
Throws:
JRException

loadObject

public static java.lang.Object loadObject(java.io.File file)
                                   throws JRException
Throws:
JRException

loadObject

public static java.lang.Object loadObject(java.net.URL url)
                                   throws JRException
Throws:
JRException

loadObject

public static java.lang.Object loadObject(java.io.InputStream is)
                                   throws JRException
Throws:
JRException

loadObjectFromLocation

public static java.lang.Object loadObjectFromLocation(java.lang.String location)
                                               throws JRException
Throws:
JRException

loadObjectFromLocation

public static java.lang.Object loadObjectFromLocation(java.lang.String location,
                                                      java.lang.ClassLoader classLoader)
                                               throws JRException
Throws:
JRException

loadBytes

public static byte[] loadBytes(java.io.File file)
                        throws JRException
Throws:
JRException

loadBytes

public static byte[] loadBytes(java.net.URL url)
                        throws JRException
Throws:
JRException

loadBytes

public static byte[] loadBytes(java.io.InputStream is)
                        throws JRException
Throws:
JRException

loadBytesFromLocation

public static byte[] loadBytesFromLocation(java.lang.String location)
                                    throws JRException
Throws:
JRException

loadBytesFromLocation

public static byte[] loadBytesFromLocation(java.lang.String location,
                                           java.lang.ClassLoader classLoader)
                                    throws JRException
Throws:
JRException

getLocationInputStream

public static java.io.InputStream getLocationInputStream(java.lang.String location)
                                                  throws JRException
Tries to open an input stream for a location.

The method tries to interpret the location as a file name, a resource name or an URL. If any of these succeed, an input stream is created and returned.

Parameters:
location - the location
Returns:
an input stream if the location is an existing file name, a resource name on the classpath or an URL or null otherwise.
Throws:
JRException

getFileInputStream

public static java.io.InputStream getFileInputStream(java.lang.String filename)
                                              throws JRException
Tries to open a file for reading.

Parameters:
filename - the file name
Returns:
an input stream for the file or null if the file was not found
Throws:
JRException

getResourceInputStream

public static java.io.InputStream getResourceInputStream(java.lang.String resource)
Tries to open an input stream for a resource.

Parameters:
resource - the resource name
Returns:
an input stream for the resource or null if the resource was not found

getURLInputStream

public static java.io.InputStream getURLInputStream(java.lang.String spec)
                                             throws JRException
Tries to open an input stream for an URL.

Parameters:
spec - the string to parse as an URL
Returns:
an input stream for the URL or null if spec is not a valid URL
Throws:
JRException


© 2001-2005 JasperSoft Corporation www.jaspersoft.com