Class RMJSONWriter


  • public class RMJSONWriter
    extends java.lang.Object
    Writes a JSON to string.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMJSONWriter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.StringBuffer append​(java.lang.StringBuffer aSB, RMJSONNode aNode)
      Returns a string buffer for given JSON node.
      protected java.lang.StringBuffer appendNewlineIndent​(java.lang.StringBuffer aSB)
      Appends newline and indent.
      protected java.lang.StringBuffer appendNewlineIndent​(java.lang.StringBuffer aSB, int aLevel)
      Appends newline and indent.
      java.lang.String getIndent()
      Returns the current indent.
      java.lang.String getString​(RMJSONNode aNode)
      Returns a string for given JSON node.
      java.lang.StringBuffer getStringBuffer​(RMJSONNode aNode)
      Returns a string buffer for given JSON node.
      boolean isCompacted()
      Returns whether writer compacts JSON (no indent or newline).
      protected boolean isDeep​(RMJSONNode aNode)
      Returns whether given node has child Map or List of Map/List.
      RMJSONWriter setCompacted​(boolean aValue)
      Sets whether writer compacts JSON (no indent or newline).
      RMJSONWriter setIndent​(java.lang.String anIndent)
      Sets the current indent string.
      void writeJSON​(RMJSONNode aNode, java.lang.String aPath)
      Writes the given JSON object to given file path.
      • Methods inherited from class java.lang.Object

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

      • RMJSONWriter

        public RMJSONWriter()
    • Method Detail

      • getIndent

        public java.lang.String getIndent()
        Returns the current indent.
      • setIndent

        public RMJSONWriter setIndent​(java.lang.String anIndent)
        Sets the current indent string.
      • isCompacted

        public boolean isCompacted()
        Returns whether writer compacts JSON (no indent or newline).
      • setCompacted

        public RMJSONWriter setCompacted​(boolean aValue)
        Sets whether writer compacts JSON (no indent or newline).
      • getString

        public java.lang.String getString​(RMJSONNode aNode)
        Returns a string for given JSON node.
      • getStringBuffer

        public java.lang.StringBuffer getStringBuffer​(RMJSONNode aNode)
        Returns a string buffer for given JSON node.
      • append

        protected java.lang.StringBuffer append​(java.lang.StringBuffer aSB,
                                                RMJSONNode aNode)
        Returns a string buffer for given JSON node.
      • appendNewlineIndent

        protected java.lang.StringBuffer appendNewlineIndent​(java.lang.StringBuffer aSB)
        Appends newline and indent.
      • appendNewlineIndent

        protected java.lang.StringBuffer appendNewlineIndent​(java.lang.StringBuffer aSB,
                                                             int aLevel)
        Appends newline and indent.
      • writeJSON

        public void writeJSON​(RMJSONNode aNode,
                              java.lang.String aPath)
        Writes the given JSON object to given file path.
      • isDeep

        protected boolean isDeep​(RMJSONNode aNode)
        Returns whether given node has child Map or List of Map/List.