public class PersistenceUtil
extends java.lang.Object
| Constructor and Description |
|---|
PersistenceUtil(java.io.BufferedReader reader,
boolean closeWhenDone) |
PersistenceUtil(java.io.BufferedWriter writer,
boolean closeWhenDone) |
PersistenceUtil(com.google.gson.stream.JsonReader reader,
boolean closeWhenDone) |
PersistenceUtil(com.google.gson.stream.JsonWriter writer,
boolean closeWhenDone) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static <T> T |
deserializeFromJson(java.lang.String s,
java.lang.Class<T> cls) |
void |
flush() |
java.lang.Object |
getContent() |
int |
getContentIndex() |
com.google.gson.stream.JsonReader |
getJsonReader() |
com.google.gson.stream.JsonWriter |
getJsonWriter() |
boolean |
isCloseWhenDone() |
void |
println(java.lang.String s) |
java.lang.String |
readLine() |
java.lang.String |
readToEnd() |
static java.lang.String |
serializeCompactlyToJson(java.lang.Object obj)
Serializes object so that no newline is present.
|
static java.lang.String |
serializeCompactlyToJson(java.lang.Object obj,
java.lang.Class<?> cls)
Serializes object so that no newline is present.
|
static java.lang.String |
serializeFormattedToJson(java.lang.Object obj)
Serializes object with whitespace formatting so that during testing
output files can be conveniently investigated.
|
void |
setContent(java.lang.Object content) |
void |
setContentIndex(int contentIndex) |
public PersistenceUtil(java.io.BufferedReader reader,
boolean closeWhenDone)
public PersistenceUtil(java.io.BufferedWriter writer,
boolean closeWhenDone)
public PersistenceUtil(com.google.gson.stream.JsonReader reader,
boolean closeWhenDone)
public PersistenceUtil(com.google.gson.stream.JsonWriter writer,
boolean closeWhenDone)
public static java.lang.String serializeCompactlyToJson(java.lang.Object obj)
obj - object to serializepublic static java.lang.String serializeCompactlyToJson(java.lang.Object obj,
java.lang.Class<?> cls)
obj - object to serializecls - superclass whose fields should be used.public static java.lang.String serializeFormattedToJson(java.lang.Object obj)
obj - object to serializepublic static <T> T deserializeFromJson(java.lang.String s,
java.lang.Class<T> cls)
public void println(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic void flush()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String readToEnd()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readLine()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOExceptionpublic boolean isCloseWhenDone()
public java.lang.Object getContent()
public void setContent(java.lang.Object content)
public int getContentIndex()
public void setContentIndex(int contentIndex)
public com.google.gson.stream.JsonReader getJsonReader()
public com.google.gson.stream.JsonWriter getJsonWriter()