| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>JsonGenerator</title> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../script.js"></script> |
| |
| <link rel="shortcut icon" href="/img/jakarta-favicon.ico"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="JsonGenerator"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <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-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../jakarta/json/stream/JsonGeneratorFactory.html" title="interface in jakarta.json.stream"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?jakarta/json/stream/JsonGenerator.html" target="_top">Frames</a></li> |
| <li><a href="JsonGenerator.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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </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">jakarta.json.stream</div> |
| <h2 title="Interface JsonGenerator" class="title">Interface JsonGenerator</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd>java.lang.AutoCloseable, java.io.Closeable, java.io.Flushable</dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">JsonGenerator</span> |
| extends java.io.Flushable, java.io.Closeable</pre> |
| <div class="block">Writes JSON data to an output source in a streaming way. The class |
| <a href="../../../jakarta/json/Json.html" title="class in jakarta.json"><code>Json</code></a> contains methods to create generators for character |
| or output streams (<code>Writer</code> and <code>OutputStream</code>). |
| |
| <p> |
| The following example shows how to create a JSON generator: |
| <pre> |
| <code> |
| JsonGenerator generator = Json.createGenerator(...); |
| </code> |
| </pre> |
| |
| <p> |
| The class <a href="../../../jakarta/json/stream/JsonGeneratorFactory.html" title="interface in jakarta.json.stream"><code>JsonGeneratorFactory</code></a> also contains methods to create |
| <code>JsonGenerator</code> instances. <a href="../../../jakarta/json/stream/JsonGeneratorFactory.html" title="interface in jakarta.json.stream"><code>JsonGeneratorFactory</code></a> should be used |
| when creating multiple generator instances, as in the following example: |
| <pre> |
| <code> |
| JsonGeneratorFactory factory = Json.createGeneratorFactory(); |
| JsonGenerator generator1 = factory.createGenerator(...); |
| JsonGenerator generator2 = factory.createGenerator(...); |
| </code> |
| </pre> |
| |
| <p> |
| JSON objects can be created using <code>JsonGenerator</code> by calling the |
| <a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartObject--"><code>writeStartObject()</code></a> method and then adding name/value pairs with the |
| <code>write</code> method. |
| <p> |
| The following example shows how to generate an empty JSON object: |
| <pre> |
| <code> |
| JsonGenerator generator = ...; |
| generator.writeStartObject().writeEnd().close(); |
| </code> |
| </pre> |
| |
| JSON arrays can be created using <code>JsonGenerator</code> by calling the |
| <a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartArray--"><code>writeStartArray()</code></a> method and then adding values with the |
| <code>write</code> method. |
| |
| <p> |
| The following example shows how to generate an empty JSON array: |
| <pre> |
| <code> |
| JsonGenerator generator = ...; |
| generator.writeStartArray().writeEnd().close(); |
| </code> |
| </pre> |
| |
| <p> |
| Other JSON values (that are not JSON objects or arrays) can be created |
| by calling the appropiate <code>write</code> methods. |
| <p> |
| The following example shows how to generate a JSON string: |
| <pre><code> |
| JsonGenerator generator = ...; |
| generator.write("message").close(); |
| </code></pre> |
| |
| <code>JsonGenerator</code> methods can be chained as in the following example: |
| <pre> |
| <code> |
| generator |
| .writeStartObject() |
| .write("firstName", "John") |
| .write("lastName", "Smith") |
| .write("age", 25) |
| .writeStartObject("address") |
| .write("streetAddress", "21 2nd Street") |
| .write("city", "New York") |
| .write("state", "NY") |
| .write("postalCode", "10021") |
| .writeEnd() |
| .writeStartArray("phoneNumber") |
| .writeStartObject() |
| .write("type", "home") |
| .write("number", "212 555-1234") |
| .writeEnd() |
| .writeStartObject() |
| .write("type", "fax") |
| .write("number", "646 555-4567") |
| .writeEnd() |
| .writeEnd() |
| .writeEnd(); |
| generator.close(); |
| </code> |
| </pre> |
| |
| The example code above generates the following JSON (or equivalent): |
| <pre> |
| <code> |
| { |
| "firstName": "John", "lastName": "Smith", "age": 25, |
| "address" : { |
| "streetAddress": "21 2nd Street", |
| "city": "New York", |
| "state": "NY", |
| "postalCode": "10021" |
| }, |
| "phoneNumber": [ |
| {"type": "home", "number": "212 555-1234"}, |
| {"type": "fax", "number": "646 555-4567"} |
| ] |
| } |
| </code> |
| </pre> |
| |
| The generated JSON text must strictly conform to the grammar defined in |
| <a href="http://www.ietf.org/rfc/rfc7159.txt">RFC 7159</a>.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../jakarta/json/Json.html" title="class in jakarta.json"><code>Json</code></a>, |
| <a href="../../../jakarta/json/stream/JsonGeneratorFactory.html" title="interface in jakarta.json.stream"><code>JsonGeneratorFactory</code></a></dd> |
| <dt><span class="simpleTagLabel">Examples (en):</span></dt> |
| <dd><a href="../../../../../../tomee-9.0/examples/jsonb-custom-serializer.html">jsonb-custom-serializer</a></dd> |
| <dt><span class="simpleTagLabel">Examples (pt):</span></dt> |
| <dd><a href="../../../../../../tomee-9.0/pt/examples/jsonb-custom-serializer.html">jsonb-custom-serializer</a></dd> |
| </dl> |
| </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> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#PRETTY_PRINTING">PRETTY_PRINTING</a></span></code> |
| <div class="block">Configuration property to generate JSON prettily.</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="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#close--">close</a></span>()</code> |
| <div class="block">Closes this generator and frees any resources associated with it.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#flush--">flush</a></span>()</code> |
| <div class="block">Flushes the underlying output source.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.math.BigDecimal-">write</a></span>(java.math.BigDecimal value)</code> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.math.BigInteger-">write</a></span>(java.math.BigInteger value)</code> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-boolean-">write</a></span>(boolean value)</code> |
| <div class="block">Writes a JSON true or false value within the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-double-">write</a></span>(double value)</code> |
| <div class="block">Writes the specified value as a JSON number value within the current |
| array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-int-">write</a></span>(int value)</code> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-jakarta.json.JsonValue-">write</a></span>(<a href="../../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a> value)</code> |
| <div class="block">Writes the specified value as a JSON value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-long-">write</a></span>(long value)</code> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-">write</a></span>(java.lang.String value)</code> |
| <div class="block">Writes the specified value as a JSON string value within |
| the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-java.math.BigDecimal-">write</a></span>(java.lang.String name, |
| java.math.BigDecimal value)</code> |
| <div class="block">Writes a JSON name/number value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-java.math.BigInteger-">write</a></span>(java.lang.String name, |
| java.math.BigInteger value)</code> |
| <div class="block">Writes a JSON name/number value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-boolean-">write</a></span>(java.lang.String name, |
| boolean value)</code> |
| <div class="block">Writes a JSON name/boolean value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-double-">write</a></span>(java.lang.String name, |
| double value)</code> |
| <div class="block">Writes a JSON name/number value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-int-">write</a></span>(java.lang.String name, |
| int value)</code> |
| <div class="block">Writes a JSON name/number value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-jakarta.json.JsonValue-">write</a></span>(java.lang.String name, |
| <a href="../../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a> value)</code> |
| <div class="block">Writes a JSON name/value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-long-">write</a></span>(java.lang.String name, |
| long value)</code> |
| <div class="block">Writes a JSON name/number value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#write-java.lang.String-java.lang.String-">write</a></span>(java.lang.String name, |
| java.lang.String value)</code> |
| <div class="block">Writes a JSON name/string value pair in the current object context.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeEnd--">writeEnd</a></span>()</code> |
| <div class="block">Writes the end of the current context.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeKey-java.lang.String-">writeKey</a></span>(java.lang.String name)</code> |
| <div class="block">Writes the JSON name with a colon.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeNull--">writeNull</a></span>()</code> |
| <div class="block">Writes a JSON null value within the current array, field or root context.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeNull-java.lang.String-">writeNull</a></span>(java.lang.String name)</code> |
| <div class="block">Writes a JSON name/null value pair in an current object context.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartArray--">writeStartArray</a></span>()</code> |
| <div class="block">Writes the JSON start array character.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartArray-java.lang.String-">writeStartArray</a></span>(java.lang.String name)</code> |
| <div class="block">Writes the JSON name/start array character pair with in the current |
| object context.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartObject--">writeStartObject</a></span>()</code> |
| <div class="block">Writes the JSON start object character.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/json/stream/JsonGenerator.html#writeStartObject-java.lang.String-">writeStartObject</a></span>(java.lang.String name)</code> |
| <div class="block">Writes the JSON name/start object character pair in the current |
| object context.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="PRETTY_PRINTING"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>PRETTY_PRINTING</h4> |
| <pre>static final java.lang.String PRETTY_PRINTING</pre> |
| <div class="block">Configuration property to generate JSON prettily. All providers |
| must support this property. The value of the property could be |
| be anything.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../constant-values.html#jakarta.json.stream.JsonGenerator.PRETTY_PRINTING">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="writeStartObject--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeStartObject</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeStartObject()</pre> |
| <div class="block">Writes the JSON start object character. It starts a new child object |
| context within which JSON name/value pairs can be written to the object. |
| This method is valid only in an array context, field context or in no context (when a |
| context is not yet started). This method can only be called once in |
| no context.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is called within an |
| object context or if it is called more than once in no context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeStartObject-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeStartObject</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeStartObject(java.lang.String name)</pre> |
| <div class="block">Writes the JSON name/start object character pair in the current |
| object context. It starts a new child object context within which JSON |
| name/value pairs can be written to the object.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name within the JSON name/object pair to be written</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeKey-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeKey</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeKey(java.lang.String name)</pre> |
| <div class="block">Writes the JSON name with a colon. It starts a field context, in which valid |
| options are writing a value, starting an object or an array. |
| |
| Writing value closes field context, if object or array is started after field name, |
| field context will be closed after object/array close.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - name of json field</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeStartArray--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeStartArray</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeStartArray()</pre> |
| <div class="block">Writes the JSON start array character. It starts a new child array |
| context within which JSON values can be written to the array. This |
| method is valid only in an array context, field context or in no context (when a |
| context is not yet started). This method can only be called once in |
| no context.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is called within an |
| object context or if called more than once in no context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeStartArray-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeStartArray</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeStartArray(java.lang.String name)</pre> |
| <div class="block">Writes the JSON name/start array character pair with in the current |
| object context. It starts a new child array context within which JSON |
| values can be written to the array.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name within the JSON name/array pair to be written</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within |
| an object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-jakarta.json.JsonValue-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| <a href="../../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a> value)</pre> |
| <div class="block">Writes a JSON name/value pair in the current object context.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/value pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/value pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| java.lang.String value)</pre> |
| <div class="block">Writes a JSON name/string value pair in the current object context. |
| The specified value is written as JSON string value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/string pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/string pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-java.math.BigInteger-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| java.math.BigInteger value)</pre> |
| <div class="block">Writes a JSON name/number value pair in the current object context. |
| The specified value is written as a JSON number value. The string |
| <code>new BigDecimal(value).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-java.math.BigDecimal-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| java.math.BigDecimal value)</pre> |
| <div class="block">Writes a JSON name/number value pair in the current object context. |
| The specified value is written as a JSON number value. The specified |
| value's <code>toString()</code> is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| int value)</pre> |
| <div class="block">Writes a JSON name/number value pair in the current object context. |
| The specified value is written as a JSON number value. The string |
| <code>new BigDecimal(value).toString()</code> is used as the text value |
| for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| long value)</pre> |
| <div class="block">Writes a JSON name/number value pair in the current object context. |
| The specified value is written as a JSON number value. The string |
| <code>new BigDecimal(value).toString()</code> is used as the text |
| value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-double-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| double value)</pre> |
| <div class="block">Writes a JSON name/number value pair in the current object context. |
| The specified value is written as a JSON number value. The string |
| <code>BigDecimal.valueOf(double).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/number pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code>java.lang.NumberFormatException</code> - if the value is Not-a-Number (NaN) or infinity.</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String name, |
| boolean value)</pre> |
| <div class="block">Writes a JSON name/boolean value pair in the current object context. |
| If value is true, it writes the JSON <code>true</code> value, otherwise |
| it writes the JSON <code>false</code> value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/boolean pair to be written in |
| current JSON object</dd> |
| <dd><code>value</code> - a value in the JSON name/boolean pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeNull-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeNull</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeNull(java.lang.String name)</pre> |
| <div class="block">Writes a JSON name/null value pair in an current object context.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a name in the JSON name/null pair to be written in |
| current JSON object</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| object context</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeEnd--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeEnd</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeEnd()</pre> |
| <div class="block">Writes the end of the current context. If the current context is |
| an array context, this method writes the end-of-array character (']'). |
| If the current context is an object context, this method writes the |
| end-of-object character ('}'). After writing the end of the current |
| context, the parent context becomes the new current context. |
| If parent context is field context, it is closed.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is called in no context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-jakarta.json.JsonValue-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(<a href="../../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a> value)</pre> |
| <div class="block">Writes the specified value as a JSON value within |
| the current array, field or root context.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.lang.String value)</pre> |
| <div class="block">Writes the specified value as a JSON string value within |
| the current array, field or root context.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.math.BigDecimal-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.math.BigDecimal value)</pre> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context. The specified value's <code>toString()</code> |
| is used as the the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../jakarta/json/JsonNumber.html" title="interface in jakarta.json"><code>JsonNumber</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-java.math.BigInteger-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(java.math.BigInteger value)</pre> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context. The string <code>new BigDecimal(value).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../jakarta/json/JsonNumber.html" title="interface in jakarta.json"><code>JsonNumber</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(int value)</pre> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context. The string <code>new BigDecimal(value).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(long value)</pre> |
| <div class="block">Writes the specified value as a JSON number value within |
| the current array, field or root context. The string <code>new BigDecimal(value).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-double-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(double value)</pre> |
| <div class="block">Writes the specified value as a JSON number value within the current |
| array, field or root context. The string <code>BigDecimal.valueOf(value).toString()</code> |
| is used as the text value for writing.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a value to be written in current JSON array</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| <dd><code>java.lang.NumberFormatException</code> - if the value is Not-a-Number (NaN) or infinity.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="write-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>write</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> write(boolean value)</pre> |
| <div class="block">Writes a JSON true or false value within the current array, field or root context. |
| If value is true, this method writes the JSON <code>true</code> value, |
| otherwise it writes the JSON <code>false</code> value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - a <code>boolean</code> value</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="writeNull--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>writeNull</h4> |
| <pre><a href="../../../jakarta/json/stream/JsonGenerator.html" title="interface in jakarta.json.stream">JsonGenerator</a> writeNull()</pre> |
| <div class="block">Writes a JSON null value within the current array, field or root context.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this generator</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if this method is not called within an |
| array, root or field context.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="close--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>void close()</pre> |
| <div class="block">Closes this generator and frees any resources associated with it. |
| This method closes the underlying output source. |
| |
| The underlying stream is closed only if complete JSON object is written. In case |
| of incomplete object JsonGenerationException is thrown and underlying stream is |
| not closed.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>close</code> in interface <code>java.lang.AutoCloseable</code></dd> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>close</code> in interface <code>java.io.Closeable</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</dd> |
| <dd><code><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream">JsonGenerationException</a></code> - if an incomplete JSON is generated</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="flush--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>flush</h4> |
| <pre>void flush()</pre> |
| <div class="block">Flushes the underlying output source. If the generator has saved |
| any characters in a buffer, writes them immediately to the underlying |
| output source before flushing it.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>flush</code> in interface <code>java.io.Flushable</code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if an i/o error occurs (IOException |
| would be cause of JsonException)</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> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <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-all.html">Index</a></li> |
| <li><a href="../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../jakarta/json/stream/JsonGenerationException.html" title="class in jakarta.json.stream"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../jakarta/json/stream/JsonGeneratorFactory.html" title="interface in jakarta.json.stream"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?jakarta/json/stream/JsonGenerator.html" target="_top">Frames</a></li> |
| <li><a href="JsonGenerator.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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |