Class JSONWriter

java.lang.Object
com.infoteria.asteria.util.xml.JSONWriter

public class JSONWriter extends Object
XMLをJSONに書き出すクラス
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    ラップしているOutputStream(またはWriter)をcloseします
    boolean
    ルートエレメントを省略してJSONテキストにするかどうかを返します
    boolean
    名前空間プレフィクスを無視するかどうかを返します
    boolean
    JSONテキストでインデントするかどうかを返します
    boolean
    括り文字を「"」にするかどうかを返します
    static void
    main(String[] args)
    引数のファイルをJSON化してコンソールに出力します
    第1引数 ファイルパス 第2引数 インデントするかどうか(省略時は true)
    void
    setIgnorePrefix(boolean b)
    名前空間プレフィクスを無視するかどうかを設定します
    void
    setIndent(boolean b)
    JSONテキストでインデントするかどうかを設定します
    void
    setOmitRootElement(boolean b)
    ルートエレメントを省略してJSONテキストにするかどうかを設定します
    void
    setQuoteIsDQ(boolean b)
    括り文字を「"」にするかどうかを設定します
    static String
    toString(Document doc, boolean indent)
    Documentの文書要素をJSON文字列化します
    static String
    toString(Element el, boolean indent)
    要素をJSON文字列化します
    void
    Documentの文書要素をJSON化します
    void
    write(Document doc, boolean omitRootElement)
    Documentの文書要素をJSON化します
    void
    要素をJSON化します

    Methods inherited from class java.lang.Object

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

    • JSONWriter

      public JSONWriter(OutputStream stream)
    • JSONWriter

      public JSONWriter(Writer writer)
  • Method Details

    • isIndent

      public boolean isIndent()
      JSONテキストでインデントするかどうかを返します
    • setIndent

      public void setIndent(boolean b)
      JSONテキストでインデントするかどうかを設定します
    • isQuoteIsDQ

      public boolean isQuoteIsDQ()
      括り文字を「"」にするかどうかを返します
    • setQuoteIsDQ

      public void setQuoteIsDQ(boolean b)
      括り文字を「"」にするかどうかを設定します
    • isIgnorePrefix

      public boolean isIgnorePrefix()
      名前空間プレフィクスを無視するかどうかを返します
    • setIgnorePrefix

      public void setIgnorePrefix(boolean b)
      名前空間プレフィクスを無視するかどうかを設定します
    • doOmitRootElement

      public boolean doOmitRootElement()
      ルートエレメントを省略してJSONテキストにするかどうかを返します
    • setOmitRootElement

      public void setOmitRootElement(boolean b)
      ルートエレメントを省略してJSONテキストにするかどうかを設定します
    • close

      public void close() throws IOException
      ラップしているOutputStream(またはWriter)をcloseします
      Throws:
      IOException
    • write

      public void write(Document doc) throws IOException
      Documentの文書要素をJSON化します
      Throws:
      IOException
    • write

      public void write(Document doc, boolean omitRootElement) throws IOException
      Documentの文書要素をJSON化します
      Throws:
      IOException
    • write

      public void write(Element el) throws IOException
      要素をJSON化します
      Throws:
      IOException
    • toString

      public static String toString(Document doc, boolean indent)
      Documentの文書要素をJSON文字列化します
      Parameters:
      doc - JSON化するDocument
      indent - 出力をインデントするかどうか
    • toString

      public static String toString(Element el, boolean indent)
      要素をJSON文字列化します
      Parameters:
      el - JSON化する要素
      indent - 出力をインデントするかどうか
    • main

      public static void main(String[] args) throws Exception
      引数のファイルをJSON化してコンソールに出力します
      第1引数 ファイルパス 第2引数 インデントするかどうか(省略時は true)
      Throws:
      Exception