Class RMArchiver


  • public class RMArchiver
    extends java.lang.Object
    This class handles RM's legacy unarchival.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  RMArchiver.Archiving
      This interface defines the method necessary to add archival support to an object.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMArchiver()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.Class classForClassName​(java.lang.String name, int version)  
      static byte[] fixBytes​(byte[] bytes)
      Fixes old RM PList documents that incorrectly added newlines inside elements (just before or after tag).
      static java.lang.String getError()  
      static java.util.Map getRPTMap()
      Returns a class map to map xml element tag names to ReportMill classes.
      boolean hasValueNamed​(java.lang.String name)
      Returns whether there is a value with given name.
      static boolean isXML​(byte[] bytes)
      Tells whether inputStream starts with XML - of course it invalidates the stream, too (iStream.reset() doesn't work).
      java.lang.Object objectFromBytes​(byte[] bytes)
      Unarchives an object from byte array.
      java.lang.Boolean readBooleanWithName​(java.lang.String name)
      Returns Boolean for given name/default-value.
      java.lang.Boolean readBooleanWithName​(java.lang.String name, java.lang.Boolean defaultValue)  
      boolean readBoolWithName​(java.lang.String name)
      Returns boolean for given name/default-value.
      boolean readBoolWithName​(java.lang.String name, boolean defaultValue)  
      float[] readFloatArrayWithName​(java.lang.String name, int count)
      Returns float array for given name.
      float readFloatWithName​(java.lang.String name)
      Returns float for given name/default-value.
      float readFloatWithName​(java.lang.String name, float defaultValue)  
      void readIntArrayWithName​(int[] array, java.lang.String name)
      Returns int array for given name.
      int readIntWithName​(java.lang.String name)
      Returns int for given name/default-value.
      int readIntWithName​(java.lang.String name, int defaultValue)  
      java.lang.Object readObject​(java.lang.Object aSource)
      Unarchives an object from a File, String path, URL, byte array, etc.
      java.lang.Object readObjectWithName​(java.lang.String name)
      Unarchives the named object from the current map.
      java.lang.Object readObjectWithName​(java.lang.String name, java.lang.Object defaultVal)
      Unarchives the named object from the current map.
      java.lang.Object readObjectWithName​(java.lang.String name, java.lang.Object defaultValue, boolean useDefault)
      Unarchives the named object from the current map.
      RMRect readRectWithName​(java.lang.String name)
      Returns rect for given name.
      java.lang.String readStringWithName​(java.lang.String nameString)
      Returns string for given name/default-value.
      java.lang.String readStringWithName​(java.lang.String nameString, java.lang.String defaultValue)  
      byte[] readUnsignedCharArrayWithName​(java.lang.String name, int count)
      Returns unsigned char array for given name.
      void rememberObject​(java.lang.Object newObject)
      Called by objects during unarchival to record the actual instance that was created.
      java.lang.Object unarchiveObject​(java.lang.Object newObject, java.lang.Object newInstance)
      Unarchives an object from the given generic value.
      int version()
      Returns the version of the currently unarchiving document.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RMArchiver

        public RMArchiver()
    • Method Detail

      • version

        public int version()
        Returns the version of the currently unarchiving document.
      • readObject

        public java.lang.Object readObject​(java.lang.Object aSource)
        Unarchives an object from a File, String path, URL, byte array, etc.
      • objectFromBytes

        public java.lang.Object objectFromBytes​(byte[] bytes)
        Unarchives an object from byte array.
      • readObjectWithName

        public java.lang.Object readObjectWithName​(java.lang.String name)
        Unarchives the named object from the current map.
      • readObjectWithName

        public java.lang.Object readObjectWithName​(java.lang.String name,
                                                   java.lang.Object defaultVal)
        Unarchives the named object from the current map.
      • readObjectWithName

        public java.lang.Object readObjectWithName​(java.lang.String name,
                                                   java.lang.Object defaultValue,
                                                   boolean useDefault)
        Unarchives the named object from the current map.
      • unarchiveObject

        public java.lang.Object unarchiveObject​(java.lang.Object newObject,
                                                java.lang.Object newInstance)
        Unarchives an object from the given generic value.
      • readBoolWithName

        public boolean readBoolWithName​(java.lang.String name)
        Returns boolean for given name/default-value.
      • readBoolWithName

        public boolean readBoolWithName​(java.lang.String name,
                                        boolean defaultValue)
      • readBooleanWithName

        public java.lang.Boolean readBooleanWithName​(java.lang.String name)
        Returns Boolean for given name/default-value.
      • readBooleanWithName

        public java.lang.Boolean readBooleanWithName​(java.lang.String name,
                                                     java.lang.Boolean defaultValue)
      • readIntWithName

        public int readIntWithName​(java.lang.String name)
        Returns int for given name/default-value.
      • readIntWithName

        public int readIntWithName​(java.lang.String name,
                                   int defaultValue)
      • readFloatWithName

        public float readFloatWithName​(java.lang.String name)
        Returns float for given name/default-value.
      • readFloatWithName

        public float readFloatWithName​(java.lang.String name,
                                       float defaultValue)
      • readRectWithName

        public RMRect readRectWithName​(java.lang.String name)
        Returns rect for given name.
      • rememberObject

        public void rememberObject​(java.lang.Object newObject)
        Called by objects during unarchival to record the actual instance that was created.
      • hasValueNamed

        public boolean hasValueNamed​(java.lang.String name)
        Returns whether there is a value with given name.
      • readStringWithName

        public java.lang.String readStringWithName​(java.lang.String nameString)
        Returns string for given name/default-value.
      • readStringWithName

        public java.lang.String readStringWithName​(java.lang.String nameString,
                                                   java.lang.String defaultValue)
      • readUnsignedCharArrayWithName

        public byte[] readUnsignedCharArrayWithName​(java.lang.String name,
                                                    int count)
        Returns unsigned char array for given name.
      • readIntArrayWithName

        public void readIntArrayWithName​(int[] array,
                                         java.lang.String name)
        Returns int array for given name.
      • readFloatArrayWithName

        public float[] readFloatArrayWithName​(java.lang.String name,
                                              int count)
        Returns float array for given name.
      • getError

        public static java.lang.String getError()
      • getRPTMap

        public static java.util.Map getRPTMap()
        Returns a class map to map xml element tag names to ReportMill classes.
      • isXML

        public static boolean isXML​(byte[] bytes)
        Tells whether inputStream starts with XML - of course it invalidates the stream, too (iStream.reset() doesn't work).
      • classForClassName

        protected static java.lang.Class classForClassName​(java.lang.String name,
                                                           int version)
      • fixBytes

        public static byte[] fixBytes​(byte[] bytes)
        Fixes old RM PList documents that incorrectly added newlines inside elements (just before or after tag).