public class DataEncoder extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DataEncoder.Snippet |
| Constructor and Description |
|---|
DataEncoder() |
DataEncoder(String newlineStr,
String indentStr) |
| Modifier and Type | Method and Description |
|---|---|
static DataEncoder.Snippet |
asSnippet(String text) |
String |
encode(Object data)
Serializes the data as ECMAScript literals
|
String |
encodeJSON(Object data)
Serializes the data as JSON
|
void |
indent(Appendable output,
int depth) |
boolean |
isPrettyPrint() |
void |
write(Appendable output,
Object data)
Serializes the data as ECMAScript literals
|
void |
write(Appendable output,
Object data,
int depth)
Serializes the data as ECMAScript literals
|
void |
writeJSON(Appendable output,
Object data)
Serializes the data as JSON
|
void |
writeln(Appendable output,
int depth) |
boolean |
writeNamespace(Appendable output,
List<String> namespaces,
String ident)
Produces more compact namespace declarations.
|
void |
writeNamespaceAlt(Appendable output,
List<String> namespaces,
String ident)
Deprecated.
|
void |
writeVars(Appendable output,
SparseMap items)
Serializes the items as JavaScript variable
|
public static DataEncoder.Snippet asSnippet(String text)
public boolean isPrettyPrint()
public String encode(Object data)
data - Data to serializepublic String encodeJSON(Object data)
data - Data to serializepublic void writeJSON(Appendable output, Object data) throws IOException
output - data - Data to serializeIOExceptionpublic void write(Appendable output, Object data) throws IOException
output - data - Data to serializeIOExceptionpublic void write(Appendable output, Object data, int depth) throws IOException
output - data - Data to serializedepth - Starting indentation depthIOExceptionpublic boolean writeNamespace(Appendable output, List<String> namespaces, String ident) throws IOException
output - namespaces - ident - IOException@Deprecated public void writeNamespaceAlt(Appendable output, List<String> namespaces, String ident) throws IOException
output - namespaces - ident - IOExceptionpublic void indent(Appendable output, int depth) throws IOException
IOExceptionpublic void writeln(Appendable output, int depth) throws IOException
IOExceptionpublic void writeVars(Appendable output, SparseMap items) throws IOException
output - items - Variables to serializeIOExceptionCopyright © 2014. All rights reserved.