PlotSquared/doc/com/intellectualcrafters/json/JSONStringer.html
2014-11-16 11:14:40 +01:00

369 lines
18 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="sv">
<head>
<!-- Generated by javadoc (version 1.7.0_67) on Sun Nov 16 11:09:55 CET 2014 -->
<title>JSONStringer</title>
<meta name="date" content="2014-11-16">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title = "JSONStringer";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/intellectualcrafters/json/JSONString.html"
title="interface in com.intellectualcrafters.json"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/intellectualcrafters/json/JSONTokener.html"
title="class in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/intellectualcrafters/json/JSONStringer.html" target="_top">Frames</a></li>
<li><a href="JSONStringer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if (window == top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields_inherited_from_class_com.intellectualcrafters.json.JSONWriter">Field</a>&nbsp;|&nbsp;
</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.intellectualcrafters.json</div>
<h2 title="Class JSONStringer" class="title">Class JSONStringer</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../com/intellectualcrafters/json/JSONWriter.html"
title="class in com.intellectualcrafters.json">com.intellectualcrafters.json.JSONWriter</a></li>
<li>
<ul class="inheritance">
<li>com.intellectualcrafters.json.JSONStringer</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">JSONStringer</span>
extends <a href="../../../com/intellectualcrafters/json/JSONWriter.html" title="class in com.intellectualcrafters.json">JSONWriter</a></pre>
<div class="block">JSONStringer provides a quick and convenient way of producing JSON text.
The texts produced strictly conform to JSON syntax rules. No whitespace is
added, so the results are ready for transmission or storage. Each instance of
JSONStringer can produce one JSON text.
<p/>
A JSONStringer instance provides a <code>value</code> method for appending
values to the text, and a <code>key</code> method for adding keys before
values in objects. There are <code>array</code> and <code>endArray</code>
methods that make and bound array values, and <code>object</code> and
<code>endObject</code> methods which make and bound object values. All of
these methods return the JSONWriter instance, permitting cascade style. For
example,
<p/>
<pre>
myString = new JSONStringer().object().key(&quot;JSON&quot;).value(&quot;Hello, World!&quot;).endObject().toString();
</pre>
<p/>
which produces the string
<p/>
<pre>
{"JSON":"Hello, World!"}
</pre>
<p/>
The first method called must be <code>array</code> or <code>object</code>.
There are no methods for adding commas or colons. JSONStringer adds them for
you. Objects and arrays can be nested up to 20 levels deep.
<p/>
This can sometimes be easier than using a JSONObject to build a string.
</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a
name="fields_inherited_from_class_com.intellectualcrafters.json.JSONWriter">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;com.intellectualcrafters.json.<a
href="../../../com/intellectualcrafters/json/JSONWriter.html"
title="class in com.intellectualcrafters.json">JSONWriter</a></h3>
<code><a href="../../../com/intellectualcrafters/json/JSONWriter.html#mode">mode</a>, <a
href="../../../com/intellectualcrafters/json/JSONWriter.html#writer">writer</a></code>
</li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a
href="../../../com/intellectualcrafters/json/JSONStringer.html#JSONStringer()">JSONStringer</a></strong>()</code>
<div class="block">Make a fresh JSONStringer.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/JSONStringer.html#toString()">toString</a></strong>()</code>
<div class="block">Return the JSON text.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a
name="methods_inherited_from_class_com.intellectualcrafters.json.JSONWriter">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;com.intellectualcrafters.json.<a
href="../../../com/intellectualcrafters/json/JSONWriter.html"
title="class in com.intellectualcrafters.json">JSONWriter</a></h3>
<code><a href="../../../com/intellectualcrafters/json/JSONWriter.html#array()">array</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#endArray()">endArray</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#endObject()">endObject</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#key(java.lang.String)">key</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#object()">object</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#value(boolean)">value</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#value(double)">value</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#value(long)">value</a>,
<a href="../../../com/intellectualcrafters/json/JSONWriter.html#value(java.lang.Object)">value</a></code>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait,
wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="JSONStringer()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>JSONStringer</h4>
<pre>public&nbsp;JSONStringer()</pre>
<div class="block">Make a fresh JSONStringer. It can be used to build one JSON text.
</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()</pre>
<div class="block">Return the JSON text. This method is used to obtain the product of
the
JSONStringer instance. It will return <code>null</code> if there was a
problem in the construction of the JSON text (such as the calls to
<code>array</code> were not properly balanced with calls to
<code>endArray</code>).
</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
<dt><span class="strong">Returns:</span></dt>
<dd>The JSON text.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/intellectualcrafters/json/JSONString.html"
title="interface in com.intellectualcrafters.json"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/intellectualcrafters/json/JSONTokener.html"
title="class in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/intellectualcrafters/json/JSONStringer.html" target="_top">Frames</a></li>
<li><a href="JSONStringer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if (window == top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields_inherited_from_class_com.intellectualcrafters.json.JSONWriter">Field</a>&nbsp;|&nbsp;
</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>