899 lines
41 KiB
HTML
899 lines
41 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.6.0_24) on Mon Jul 02 18:04:52 PDT 2012 -->
|
|
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<TITLE>
|
|
JsonWriter (Gson 2.2.2 API)
|
|
</TITLE>
|
|
|
|
<META NAME="date" CONTENT="2012-07-02">
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="JsonWriter (Gson 2.2.2 API)";
|
|
}
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
<HR>
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonWriter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../../com/google/gson/stream/JsonToken.html" title="enum in com.google.gson.stream"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../../com/google/gson/stream/MalformedJsonException.html" title="class in com.google.gson.stream"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../../index.html?com/google/gson/stream/JsonWriter.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="JsonWriter.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<H2>
|
|
<FONT SIZE="-1">
|
|
com.google.gson.stream</FONT>
|
|
<BR>
|
|
Class JsonWriter</H2>
|
|
<PRE>
|
|
<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
|
|
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.gson.stream.JsonWriter</B>
|
|
</PRE>
|
|
<DL>
|
|
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Flushable.html?is-external=true" title="class or interface in java.io">Flushable</A></DD>
|
|
</DL>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public class <B>JsonWriter</B><DT>extends <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Flushable.html?is-external=true" title="class or interface in java.io">Flushable</A></DL>
|
|
</PRE>
|
|
|
|
<P>
|
|
Writes a JSON (<a href="http://www.ietf.org/rfc/rfc4627.txt">RFC 4627</a>)
|
|
encoded value to a stream, one token at a time. The stream includes both
|
|
literal values (strings, numbers, booleans and nulls) as well as the begin
|
|
and end delimiters of objects and arrays.
|
|
|
|
<h3>Encoding JSON</h3>
|
|
To encode your data as JSON, create a new <code>JsonWriter</code>. Each JSON
|
|
document must contain one top-level array or object. Call methods on the
|
|
writer as you walk the structure's contents, nesting arrays and objects as
|
|
necessary:
|
|
<ul>
|
|
<li>To write <strong>arrays</strong>, first call <A HREF="../../../../com/google/gson/stream/JsonWriter.html#beginArray()"><CODE>beginArray()</CODE></A>.
|
|
Write each of the array's elements with the appropriate <A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(java.lang.String)"><CODE>value(java.lang.String)</CODE></A>
|
|
methods or by nesting other arrays and objects. Finally close the array
|
|
using <A HREF="../../../../com/google/gson/stream/JsonWriter.html#endArray()"><CODE>endArray()</CODE></A>.
|
|
<li>To write <strong>objects</strong>, first call <A HREF="../../../../com/google/gson/stream/JsonWriter.html#beginObject()"><CODE>beginObject()</CODE></A>.
|
|
Write each of the object's properties by alternating calls to
|
|
<A HREF="../../../../com/google/gson/stream/JsonWriter.html#name(java.lang.String)"><CODE>name(java.lang.String)</CODE></A> with the property's value. Write property values with the
|
|
appropriate <A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(java.lang.String)"><CODE>value(java.lang.String)</CODE></A> method or by nesting other objects or arrays.
|
|
Finally close the object using <A HREF="../../../../com/google/gson/stream/JsonWriter.html#endObject()"><CODE>endObject()</CODE></A>.
|
|
</ul>
|
|
|
|
<h3>Example</h3>
|
|
Suppose we'd like to encode a stream of messages such as the following: <pre> <code>[
|
|
{
|
|
"id": 912345678901,
|
|
"text": "How do I stream JSON in Java?",
|
|
"geo": null,
|
|
"user": {
|
|
"name": "json_newb",
|
|
"followers_count": 41
|
|
}
|
|
},
|
|
{
|
|
"id": 912345678902,
|
|
"text": "@json_newb just use JsonWriter!",
|
|
"geo": [50.454722, -104.606667],
|
|
"user": {
|
|
"name": "jesse",
|
|
"followers_count": 2
|
|
}
|
|
}
|
|
]</code></pre>
|
|
This code encodes the above structure: <pre> <code>public void writeJsonStream(OutputStream out, List<Message> messages) throws IOException {
|
|
JsonWriter writer = new JsonWriter(new OutputStreamWriter(out, "UTF-8"));
|
|
writer.setIndentSpaces(4);
|
|
writeMessagesArray(writer, messages);
|
|
writer.close();
|
|
}
|
|
|
|
public void writeMessagesArray(JsonWriter writer, List<Message> messages) throws IOException {
|
|
writer.beginArray();
|
|
for (Message message : messages) {
|
|
writeMessage(writer, message);
|
|
}
|
|
writer.endArray();
|
|
}
|
|
|
|
public void writeMessage(JsonWriter writer, Message message) throws IOException {
|
|
writer.beginObject();
|
|
writer.name("id").value(message.getId());
|
|
writer.name("text").value(message.getText());
|
|
if (message.getGeo() != null) {
|
|
writer.name("geo");
|
|
writeDoublesArray(writer, message.getGeo());
|
|
} else {
|
|
writer.name("geo").nullValue();
|
|
}
|
|
writer.name("user");
|
|
writeUser(writer, message.getUser());
|
|
writer.endObject();
|
|
}
|
|
|
|
public void writeUser(JsonWriter writer, User user) throws IOException {
|
|
writer.beginObject();
|
|
writer.name("name").value(user.getName());
|
|
writer.name("followers_count").value(user.getFollowersCount());
|
|
writer.endObject();
|
|
}
|
|
|
|
public void writeDoublesArray(JsonWriter writer, List<Double> doubles) throws IOException {
|
|
writer.beginArray();
|
|
for (Double value : doubles) {
|
|
writer.value(value);
|
|
}
|
|
writer.endArray();
|
|
}</code></pre>
|
|
|
|
<p>Each <code>JsonWriter</code> may be used to write a single JSON stream.
|
|
Instances of this class are not thread safe. Calls that would result in a
|
|
malformed JSON string will fail with an <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalStateException</CODE></A>.
|
|
<P>
|
|
|
|
<P>
|
|
<DL>
|
|
<DT><B>Since:</B></DT>
|
|
<DD>1.6</DD>
|
|
<DT><B>Author:</B></DT>
|
|
<DD>Jesse Wilson</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<P>
|
|
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
|
<A NAME="constructor_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Constructor Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#JsonWriter(java.io.Writer)">JsonWriter</A></B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</A> out)</CODE>
|
|
|
|
<BR>
|
|
Creates a new instance that writes a JSON-encoded stream to <code>out</code>.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
<A NAME="method_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Method Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#beginArray()">beginArray</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Begins encoding a new array.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#beginObject()">beginObject</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Begins encoding a new object.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#close()">close</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Flushes and closes this writer and the underlying <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><CODE>Writer</CODE></A>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#endArray()">endArray</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Ends encoding the current array.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#endObject()">endObject</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Ends encoding the current object.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#flush()">flush</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Ensures all buffered data is written to the underlying <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><CODE>Writer</CODE></A>
|
|
and flushes that writer.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> boolean</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#getSerializeNulls()">getSerializeNulls</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns true if object members are serialized when their value is null.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> boolean</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#isHtmlSafe()">isHtmlSafe</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns true if this writer writes JSON that's safe for inclusion in HTML
|
|
and XML documents.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> boolean</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#isLenient()">isLenient</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns true if this writer has relaxed syntax rules.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#name(java.lang.String)">name</A></B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> name)</CODE>
|
|
|
|
<BR>
|
|
Encodes the property name.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#nullValue()">nullValue</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>null</code>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#setHtmlSafe(boolean)">setHtmlSafe</A></B>(boolean htmlSafe)</CODE>
|
|
|
|
<BR>
|
|
Configure this writer to emit JSON that's safe for direct inclusion in HTML
|
|
and XML documents.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#setIndent(java.lang.String)">setIndent</A></B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> indent)</CODE>
|
|
|
|
<BR>
|
|
Sets the indentation string to be repeated for each level of indentation
|
|
in the encoded document.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#setLenient(boolean)">setLenient</A></B>(boolean lenient)</CODE>
|
|
|
|
<BR>
|
|
Configure this writer to relax its syntax rules.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#setSerializeNulls(boolean)">setSerializeNulls</A></B>(boolean serializeNulls)</CODE>
|
|
|
|
<BR>
|
|
Sets whether object members are serialized when their value is null.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(boolean)">value</A></B>(boolean value)</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>value</code>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(double)">value</A></B>(double value)</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>value</code>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(long)">value</A></B>(long value)</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>value</code>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(java.lang.Number)">value</A></B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> value)</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>value</code>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../../com/google/gson/stream/JsonWriter.html#value(java.lang.String)">value</A></B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> value)</CODE>
|
|
|
|
<BR>
|
|
Encodes <code>value</code>.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
|
|
<A NAME="constructor_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Constructor Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="JsonWriter(java.io.Writer)"><!-- --></A><H3>
|
|
JsonWriter</H3>
|
|
<PRE>
|
|
public <B>JsonWriter</B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</A> out)</PRE>
|
|
<DL>
|
|
<DD>Creates a new instance that writes a JSON-encoded stream to <code>out</code>.
|
|
For best performance, ensure <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><CODE>Writer</CODE></A> is buffered; wrapping in
|
|
<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/BufferedWriter.html?is-external=true" title="class or interface in java.io"><CODE>BufferedWriter</CODE></A> if necessary.
|
|
<P>
|
|
</DL>
|
|
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
|
|
<A NAME="method_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Method Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="setIndent(java.lang.String)"><!-- --></A><H3>
|
|
setIndent</H3>
|
|
<PRE>
|
|
public final void <B>setIndent</B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> indent)</PRE>
|
|
<DL>
|
|
<DD>Sets the indentation string to be repeated for each level of indentation
|
|
in the encoded document. If <code>indent.isEmpty()</code> the encoded document
|
|
will be compact. Otherwise the encoded document will be more
|
|
human-readable.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>indent</CODE> - a string containing only whitespace.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setLenient(boolean)"><!-- --></A><H3>
|
|
setLenient</H3>
|
|
<PRE>
|
|
public final void <B>setLenient</B>(boolean lenient)</PRE>
|
|
<DL>
|
|
<DD>Configure this writer to relax its syntax rules. By default, this writer
|
|
only emits well-formed JSON as specified by <a
|
|
href="http://www.ietf.org/rfc/rfc4627.txt">RFC 4627</a>. Setting the writer
|
|
to lenient permits the following:
|
|
<ul>
|
|
<li>Top-level values of any type. With strict writing, the top-level
|
|
value must be an object or an array.
|
|
<li>Numbers may be <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isNaN()" title="class or interface in java.lang"><CODE>NaNs</CODE></A> or <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isInfinite()" title="class or interface in java.lang"><CODE>infinities</CODE></A>.
|
|
</ul>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="isLenient()"><!-- --></A><H3>
|
|
isLenient</H3>
|
|
<PRE>
|
|
public boolean <B>isLenient</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns true if this writer has relaxed syntax rules.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setHtmlSafe(boolean)"><!-- --></A><H3>
|
|
setHtmlSafe</H3>
|
|
<PRE>
|
|
public final void <B>setHtmlSafe</B>(boolean htmlSafe)</PRE>
|
|
<DL>
|
|
<DD>Configure this writer to emit JSON that's safe for direct inclusion in HTML
|
|
and XML documents. This escapes the HTML characters <code><</code>, <code>></code>,
|
|
<code>&</code> and <code>=</code> before writing them to the stream. Without this
|
|
setting, your XML/HTML encoder should replace these characters with the
|
|
corresponding escape sequences.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="isHtmlSafe()"><!-- --></A><H3>
|
|
isHtmlSafe</H3>
|
|
<PRE>
|
|
public final boolean <B>isHtmlSafe</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns true if this writer writes JSON that's safe for inclusion in HTML
|
|
and XML documents.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setSerializeNulls(boolean)"><!-- --></A><H3>
|
|
setSerializeNulls</H3>
|
|
<PRE>
|
|
public final void <B>setSerializeNulls</B>(boolean serializeNulls)</PRE>
|
|
<DL>
|
|
<DD>Sets whether object members are serialized when their value is null.
|
|
This has no impact on array elements. The default is true.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getSerializeNulls()"><!-- --></A><H3>
|
|
getSerializeNulls</H3>
|
|
<PRE>
|
|
public final boolean <B>getSerializeNulls</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns true if object members are serialized when their value is null.
|
|
This has no impact on array elements. The default is true.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="beginArray()"><!-- --></A><H3>
|
|
beginArray</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>beginArray</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Begins encoding a new array. Each call to this method must be paired with
|
|
a call to <A HREF="../../../../com/google/gson/stream/JsonWriter.html#endArray()"><CODE>endArray()</CODE></A>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="endArray()"><!-- --></A><H3>
|
|
endArray</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>endArray</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Ends encoding the current array.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="beginObject()"><!-- --></A><H3>
|
|
beginObject</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>beginObject</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Begins encoding a new object. Each call to this method must be paired
|
|
with a call to <A HREF="../../../../com/google/gson/stream/JsonWriter.html#endObject()"><CODE>endObject()</CODE></A>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="endObject()"><!-- --></A><H3>
|
|
endObject</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>endObject</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Ends encoding the current object.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="name(java.lang.String)"><!-- --></A><H3>
|
|
name</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>name</B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> name)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes the property name.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the forthcoming value. May not be null.
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="value(java.lang.String)"><!-- --></A><H3>
|
|
value</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>value</B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> value)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>value</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the literal string value, or null to encode a null literal.
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="nullValue()"><!-- --></A><H3>
|
|
nullValue</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>nullValue</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>null</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="value(boolean)"><!-- --></A><H3>
|
|
value</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>value</B>(boolean value)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>value</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="value(double)"><!-- --></A><H3>
|
|
value</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>value</B>(double value)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>value</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - a finite value. May not be <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isNaN()" title="class or interface in java.lang"><CODE>NaNs</CODE></A> or
|
|
<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isInfinite()" title="class or interface in java.lang"><CODE>infinities</CODE></A>.
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="value(long)"><!-- --></A><H3>
|
|
value</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>value</B>(long value)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>value</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="value(java.lang.Number)"><!-- --></A><H3>
|
|
value</H3>
|
|
<PRE>
|
|
public <A HREF="../../../../com/google/gson/stream/JsonWriter.html" title="class in com.google.gson.stream">JsonWriter</A> <B>value</B>(<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> value)
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Encodes <code>value</code>.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>value</CODE> - a finite value. May not be <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isNaN()" title="class or interface in java.lang"><CODE>NaNs</CODE></A> or
|
|
<A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Double.html?is-external=true#isInfinite()" title="class or interface in java.lang"><CODE>infinities</CODE></A>.
|
|
<DT><B>Returns:</B><DD>this writer.
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="flush()"><!-- --></A><H3>
|
|
flush</H3>
|
|
<PRE>
|
|
public void <B>flush</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Ensures all buffered data is written to the underlying <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><CODE>Writer</CODE></A>
|
|
and flushes that writer.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Flushable.html?is-external=true#flush()" title="class or interface in java.io">flush</A></CODE> in interface <CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Flushable.html?is-external=true" title="class or interface in java.io">Flushable</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="close()"><!-- --></A><H3>
|
|
close</H3>
|
|
<PRE>
|
|
public void <B>close</B>()
|
|
throws <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
|
|
<DL>
|
|
<DD>Flushes and closes this writer and the underlying <A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><CODE>Writer</CODE></A>.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Specified by:</B><DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Closeable.html?is-external=true#close()" title="class or interface in java.io">close</A></CODE> in interface <CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A></CODE></DL>
|
|
</DD>
|
|
<DD><DL>
|
|
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if the JSON document is incomplete.</DL>
|
|
</DD>
|
|
</DL>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonWriter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../../com/google/gson/stream/JsonToken.html" title="enum in com.google.gson.stream"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../../com/google/gson/stream/MalformedJsonException.html" title="class in com.google.gson.stream"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../../index.html?com/google/gson/stream/JsonWriter.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="JsonWriter.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
Copyright © 2008-2012 <a href="http://www.google.com">Google, Inc.</a>. All Rights Reserved.
|
|
</BODY>
|
|
</HTML>
|