クラス JsonFlyweight


  • public class JsonFlyweight
    extends java.lang.Object
    This utility class performs pretty-printing a JSON. This class runs very fast. This class does NOT load whole JSON text into a String in memory. The methods translate characters to characters while performing pretty-printing JSON. Therefore, the methods requires very small size of memory runtime regardless how large the input JSON is (such as 300 MB). It used a buffer of 32 KB and no more.
    • コンストラクタの概要

      コンストラクタ 
      コンストラクタ 説明
      JsonFlyweight()  
    • メソッドの概要

      すべてのメソッド staticメソッド concreteメソッド 
      修飾子とタイプ メソッド 説明
      static int prettyPrint​(java.io.InputStream uglyJSON, java.io.OutputStream prettyPrintedJSON)
      This method will pretty-print a JSON as an InputStream, write the result into an OutputStream.
      static int prettyPrint​(java.io.Reader uglyJSON, java.io.Writer prettyPrintedJSON)
      This method will pretty-print a JSON as a Reader, write the result into a Writer.
      • クラスから継承されたメソッド java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • コンストラクタの詳細

      • JsonFlyweight

        public JsonFlyweight()
    • メソッドの詳細

      • prettyPrint

        public static int prettyPrint​(java.io.InputStream uglyJSON,
                                      java.io.OutputStream prettyPrintedJSON)
                               throws java.io.IOException
        This method will pretty-print a JSON as an InputStream, write the result into an OutputStream.
        パラメータ:
        uglyJSON - ugly JSON. The source could be a large file of 2 megabytes or more
        prettyPrintedJSON - pretty printed JSON
        戻り値:
        number of lines in the pretty printed JSON
        例外:
        java.io.IOException - anything may happen
      • prettyPrint

        public static int prettyPrint​(java.io.Reader uglyJSON,
                                      java.io.Writer prettyPrintedJSON)
                               throws java.io.IOException
        This method will pretty-print a JSON as a Reader, write the result into a Writer. This method runs very fast. This method requires minimum size of runtime memory.
        パラメータ:
        uglyJSON - ugly JSON. The source could be a large file of 2 megabytes or more
        prettyPrintedJSON - pretty printed JSON
        戻り値:
        number of lines in the pretty printed JSON
        例外:
        java.io.IOException - anything may happen