libgdx API

com.badlogic.gdx.utils
Class JsonWriter

java.lang.Object
  extended by java.io.Writer
      extended by com.badlogic.gdx.utils.JsonWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class JsonWriter
extends java.io.Writer

Builder style API for emitting JSON.

Author:
Nathan Sweet

Nested Class Summary
static class JsonWriter.OutputType
           
 
Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
JsonWriter(java.io.Writer writer)
           
 
Method Summary
 JsonWriter array()
           
 JsonWriter array(java.lang.String name)
           
 void close()
           
 void flush()
           
 JsonWriter name(java.lang.String name)
           
 JsonWriter object()
           
 JsonWriter object(java.lang.String name)
           
 JsonWriter pop()
           
 JsonWriter set(java.lang.String name, java.lang.Object value)
           
 void setOutputType(JsonWriter.OutputType outputType)
           
 JsonWriter value(java.lang.Object value)
           
 void write(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonWriter

public JsonWriter(java.io.Writer writer)
Method Detail

setOutputType

public void setOutputType(JsonWriter.OutputType outputType)

name

public JsonWriter name(java.lang.String name)
                throws java.io.IOException
Throws:
java.io.IOException

object

public JsonWriter object()
                  throws java.io.IOException
Throws:
java.io.IOException

array

public JsonWriter array()
                 throws java.io.IOException
Throws:
java.io.IOException

value

public JsonWriter value(java.lang.Object value)
                 throws java.io.IOException
Throws:
java.io.IOException

object

public JsonWriter object(java.lang.String name)
                  throws java.io.IOException
Throws:
java.io.IOException

array

public JsonWriter array(java.lang.String name)
                 throws java.io.IOException
Throws:
java.io.IOException

set

public JsonWriter set(java.lang.String name,
                      java.lang.Object value)
               throws java.io.IOException
Throws:
java.io.IOException

pop

public JsonWriter pop()
               throws java.io.IOException
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)