100 lines
2.5 KiB
Java
100 lines
2.5 KiB
Java
package cn.citycraft.GsonAgent.api.stream;
|
|
|
|
import java.io.Closeable;
|
|
import java.io.Flushable;
|
|
import java.io.IOException;
|
|
|
|
public abstract interface JsonWriter extends Closeable, Flushable {
|
|
|
|
/**
|
|
* An array with no elements requires no separators or newlines before it is
|
|
* closed.
|
|
*/
|
|
static final int EMPTY_ARRAY = 1;
|
|
|
|
/**
|
|
* A array with at least one value requires a comma and newline before the
|
|
* next element.
|
|
*/
|
|
static final int NONEMPTY_ARRAY = 2;
|
|
|
|
/**
|
|
* An object with no name/value pairs requires no separators or newlines
|
|
* before it is closed.
|
|
*/
|
|
static final int EMPTY_OBJECT = 3;
|
|
|
|
/**
|
|
* An object whose most recent element is a key. The next element must be a
|
|
* value.
|
|
*/
|
|
static final int DANGLING_NAME = 4;
|
|
|
|
/**
|
|
* An object with at least one name/value pair requires a comma and newline
|
|
* before the next element.
|
|
*/
|
|
static final int NONEMPTY_OBJECT = 5;
|
|
|
|
/**
|
|
* No object or array has been started.
|
|
*/
|
|
static final int EMPTY_DOCUMENT = 6;
|
|
|
|
/**
|
|
* A document with at an array or object.
|
|
*/
|
|
static final int NONEMPTY_DOCUMENT = 7;
|
|
|
|
/**
|
|
* A document that's been closed and cannot be accessed.
|
|
*/
|
|
static final int CLOSED = 8;
|
|
|
|
public JsonWriter beginArray() throws IOException;
|
|
|
|
public JsonWriter beginObject() throws IOException;
|
|
|
|
@Override
|
|
public void close() throws IOException;
|
|
|
|
public JsonWriter endArray() throws IOException;
|
|
|
|
public JsonWriter endObject() throws IOException;
|
|
|
|
@Override
|
|
public void flush() throws IOException;
|
|
|
|
public boolean getSerializeNulls();
|
|
|
|
public boolean isHtmlSafe();
|
|
|
|
public boolean isLenient();
|
|
|
|
public JsonWriter name(String name) throws IOException;
|
|
|
|
public JsonWriter nameWithoutQuotes(String name) throws IOException;
|
|
|
|
public JsonWriter nullValue() throws IOException;
|
|
|
|
public void setHtmlSafe(boolean htmlSafe);
|
|
|
|
public void setIndent(String indent);
|
|
|
|
public void setLenient(boolean lenient);
|
|
|
|
public void setSerializeNulls(boolean serializeNulls);
|
|
|
|
public JsonWriter value(boolean value) throws IOException;
|
|
|
|
public JsonWriter value(double value) throws IOException;
|
|
|
|
public JsonWriter value(long value) throws IOException;
|
|
|
|
public JsonWriter value(Number value) throws IOException;
|
|
|
|
public JsonWriter value(String value) throws IOException;
|
|
|
|
void stringExtend(String value) throws IOException;
|
|
}
|