Class JRSaver


  • public final class JRSaver
    extends java.lang.Object
    Utility class that can be used when serializable objects must be saved on disk or sent over the network through an output stream.

    Both the JasperDesign and JasperReport classes implement the java.io.Serializable interface. This allows users to store their report templates as serialized objects either in their fully modifiable state (JasperDesign objects) or in their compiled form (JasperReport objects), using various methods exposed by this class.

    Author:
    Teodor Danciu (teodord@users.sourceforge.net)
    • Field Detail

      • EXCEPTION_MESSAGE_KEY_EXPRESSIONS_CLASS_FILE_SAVE_ERROR

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_EXPRESSIONS_CLASS_FILE_SAVE_ERROR
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_FILE_SAVE_ERROR

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_FILE_SAVE_ERROR
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_SAVE_ERROR

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_OUTPUT_STREAM_SAVE_ERROR
        See Also:
        Constant Field Values
    • Method Detail

      • saveObject

        public static void saveObject​(java.lang.Object obj,
                                      java.lang.String fileName)
                               throws JRException
        Throws:
        JRException
      • saveObject

        public static void saveObject​(java.lang.Object obj,
                                      java.io.File file)
                               throws JRException
        Throws:
        JRException
      • saveObject

        public static void saveObject​(java.lang.Object obj,
                                      java.io.OutputStream os)
                               throws JRException
        Throws:
        JRException
      • saveClassSource

        public static void saveClassSource​(java.lang.String source,
                                           java.io.File file)
                                    throws JRException
        Throws:
        JRException
      • saveResource

        public static void saveResource​(java.lang.String resource,
                                        java.io.File file)