Class JSWriter


  • public class JSWriter
    extends java.lang.Object
    A low level streaming JSON writer - assumes correct sequence of calls (e.g. keys in objects). Useful when writing JSON directly from some other structure
    • Constructor Detail

      • JSWriter

        public JSWriter()
      • JSWriter

        public JSWriter​(java.io.OutputStream ps)
      • JSWriter

        public JSWriter​(org.apache.jena.atlas.io.IndentedWriter ps)
    • Method Detail

      • startOutput

        public void startOutput()
      • finishOutput

        public void finishOutput()
      • startObject

        public JSWriter startObject()
      • finishObject

        public JSWriter finishObject()
      • key

        public JSWriter key​(java.lang.String key)
      • pair

        public JSWriter pair​(java.lang.String key,
                             java.lang.String value)
      • pair

        public JSWriter pair​(java.lang.String key,
                             boolean val)
      • pair

        public JSWriter pair​(java.lang.String key,
                             long val)
      • pair

        public JSWriter pair​(java.lang.String key,
                             java.lang.Number val)
      • startArray

        public JSWriter startArray()
      • finishArray

        public JSWriter finishArray()
      • arrayElement

        public JSWriter arrayElement​(java.lang.String str)
      • arrayElement

        public JSWriter arrayElement​(boolean b)
      • arrayElement

        public JSWriter arrayElement​(long integer)
      • arraySep

        public JSWriter arraySep()
        Useful if you are manually creating arrays and so need to print array separators yourself
      • outputQuotedString

        public static java.lang.String outputQuotedString​(java.lang.String string)
      • outputQuotedString

        public static void outputQuotedString​(org.apache.jena.atlas.io.IndentedWriter out,
                                              java.lang.String string)
      • outputQuotedString

        public static void outputQuotedString​(org.apache.jena.atlas.io.IndentedWriter out,
                                              java.lang.String string,
                                              boolean allowBareWords)