Class JRLoader


  • public final class JRLoader
    extends Object
    Utility class that helps load serialized objects found in various locations such as files, URLs, and input streams.

    Many JasperReports processes, like report compilation, report filling and exporting, often work with serialized objects. Sometimes it is useful to manually load those serialized objects before submitting them to the desired JasperReport process.

    The most interesting method exposed by this class is getLocationInputStream(String location). When calling this method to load an InputStream object from the supplied location, the program first tries to interpret the location as a valid resource name. If this fails, then the program assumes that the supplied location is the name of a file on disk and tries to read from it. If no file is found at that location, it will assume that the location represents a valid URL. Only after this third try fails an exception is thrown.

    Author:
    Teodor Danciu ([email protected])