Example usage for android.util JsonWriter setIndent

List of usage examples for android.util JsonWriter setIndent

Introduction

In this page you can find the example usage for android.util JsonWriter setIndent.

Prototype

public void setIndent(String indent) 

Source Link

Document

Sets the indentation string to be repeated for each level of indentation in the encoded document.

Usage

From source file:com.fuzz.android.limelight.util.JSONTool.java

/**
 * Entry point writer method that starts the call of other writer methods.
 *
 * @param outputStream//from www.  j  ava  2  s  .com
 * @param book
 * @throws IOException
 */
public static void writeJSON(OutputStream outputStream, Book book) throws IOException {
    JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, "UTF-8"));
    writer.setIndent("  ");
    writeBook(writer, book);
    writer.close();
}

From source file:at.ac.tuwien.caa.docscan.logic.DataLog.java

private void writeJsonStream(OutputStream out, ArrayList<ShotLog> shotLogs) throws IOException {

    JsonWriter writer = new JsonWriter(new OutputStreamWriter(out, "UTF-8"));
    writer.setIndent("  ");
    writeList(writer, shotLogs);// ww w.  jav a  2 s.  c  om
    writer.close();

}