1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!-- NewPage --> 3<html lang="en"> 4<head> 5<!-- Generated by javadoc (version 1.7.0_10-ea) on Sun Jul 14 20:03:23 PDT 2013 --> 6<title>JsonStringEncoder (Jackson JSON Processor)</title> 7<meta name="date" content="2013-07-14"> 8<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> 9</head> 10<body> 11<script type="text/javascript"><!-- 12 if (location.href.indexOf('is-external=true') == -1) { 13 parent.document.title="JsonStringEncoder (Jackson JSON Processor)"; 14 } 15//--> 16</script> 17<noscript> 18<div>JavaScript is disabled on your browser.</div> 19</noscript> 20<!-- ========= START OF TOP NAVBAR ======= --> 21<div class="topNav"><a name="navbar_top"> 22<!-- --> 23</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> 24<!-- --> 25</a> 26<ul class="navList" title="Navigation"> 27<li><a href="../../../../overview-summary.html">Overview</a></li> 28<li><a href="package-summary.html">Package</a></li> 29<li class="navBarCell1Rev">Class</li> 30<li><a href="class-use/JsonStringEncoder.html">Use</a></li> 31<li><a href="package-tree.html">Tree</a></li> 32<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 33<li><a href="../../../../index-all.html">Index</a></li> 34<li><a href="../../../../help-doc.html">Help</a></li> 35</ul> 36</div> 37<div class="subNav"> 38<ul class="navList"> 39<li><a href="../../../../org/codehaus/jackson/io/IOContext.html" title="class in org.codehaus.jackson.io"><span class="strong">Prev Class</span></a></li> 40<li><a href="../../../../org/codehaus/jackson/io/MergedStream.html" title="class in org.codehaus.jackson.io"><span class="strong">Next Class</span></a></li> 41</ul> 42<ul class="navList"> 43<li><a href="../../../../index.html?org/codehaus/jackson/io/JsonStringEncoder.html" target="_top">Frames</a></li> 44<li><a href="JsonStringEncoder.html" target="_top">No Frames</a></li> 45</ul> 46<ul class="navList" id="allclasses_navbar_top"> 47<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 48</ul> 49<div> 50<script type="text/javascript"><!-- 51 allClassesLink = document.getElementById("allclasses_navbar_top"); 52 if(window==top) { 53 allClassesLink.style.display = "block"; 54 } 55 else { 56 allClassesLink.style.display = "none"; 57 } 58 //--> 59</script> 60</div> 61<div> 62<ul class="subNavList"> 63<li>Summary: </li> 64<li>Nested | </li> 65<li><a href="#field_summary">Field</a> | </li> 66<li><a href="#constructor_summary">Constr</a> | </li> 67<li><a href="#method_summary">Method</a></li> 68</ul> 69<ul class="subNavList"> 70<li>Detail: </li> 71<li><a href="#field_detail">Field</a> | </li> 72<li><a href="#constructor_detail">Constr</a> | </li> 73<li><a href="#method_detail">Method</a></li> 74</ul> 75</div> 76<a name="skip-navbar_top"> 77<!-- --> 78</a></div> 79<!-- ========= END OF TOP NAVBAR ========= --> 80<!-- ======== START OF CLASS DATA ======== --> 81<div class="header"> 82<div class="subTitle">org.codehaus.jackson.io</div> 83<h2 title="Class JsonStringEncoder" class="title">Class JsonStringEncoder</h2> 84</div> 85<div class="contentContainer"> 86<ul class="inheritance"> 87<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> 88<li> 89<ul class="inheritance"> 90<li>org.codehaus.jackson.io.JsonStringEncoder</li> 91</ul> 92</li> 93</ul> 94<div class="description"> 95<ul class="blockList"> 96<li class="blockList"> 97<hr> 98<br> 99<pre>public final class <span class="strong">JsonStringEncoder</span> 100extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> 101<div class="block">Helper class used for efficient encoding of JSON String values (including 102 JSON field names) into Strings or UTF-8 byte arrays. 103<p> 104 Note that methods in here are somewhat optimized, but not ridiculously so. 105 Reason is that conversion method results are expected to be cached so that 106 these methods will not be hot spots during normal operation.</div> 107<dl><dt><span class="strong">Since:</span></dt> 108 <dd>1.6</dd></dl> 109</li> 110</ul> 111</div> 112<div class="summary"> 113<ul class="blockList"> 114<li class="blockList"> 115<!-- =========== FIELD SUMMARY =========== --> 116<ul class="blockList"> 117<li class="blockList"><a name="field_summary"> 118<!-- --> 119</a> 120<h3>Field Summary</h3> 121<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> 122<caption><span>Fields</span><span class="tabEnd"> </span></caption> 123<tr> 124<th class="colFirst" scope="col">Modifier and Type</th> 125<th class="colLast" scope="col">Field and Description</th> 126</tr> 127<tr class="altColor"> 128<td class="colFirst"><code>protected <a href="../../../../org/codehaus/jackson/util/ByteArrayBuilder.html" title="class in org.codehaus.jackson.util">ByteArrayBuilder</a></code></td> 129<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#_byteBuilder">_byteBuilder</a></strong></code> 130<div class="block">Lazily-constructed builder used for UTF-8 encoding of text values 131 (quoted and unquoted)</div> 132</td> 133</tr> 134<tr class="rowColor"> 135<td class="colFirst"><code>protected char[]</code></td> 136<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#_quoteBuffer">_quoteBuffer</a></strong></code> 137<div class="block">Temporary buffer used for composing quote/escape sequences</div> 138</td> 139</tr> 140<tr class="altColor"> 141<td class="colFirst"><code>protected <a href="../../../../org/codehaus/jackson/util/TextBuffer.html" title="class in org.codehaus.jackson.util">TextBuffer</a></code></td> 142<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#_textBuffer">_textBuffer</a></strong></code> 143<div class="block">Lazily constructed text buffer used to produce JSON encoded Strings 144 as characters (without UTF-8 encoding)</div> 145</td> 146</tr> 147<tr class="rowColor"> 148<td class="colFirst"><code>protected static <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang">ThreadLocal</a><<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ref/SoftReference.html?is-external=true" title="class or interface in java.lang.ref">SoftReference</a><<a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html" title="class in org.codehaus.jackson.io">JsonStringEncoder</a>>></code></td> 149<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#_threadEncoder">_threadEncoder</a></strong></code> 150<div class="block">This <code>ThreadLocal</code> contains a <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ref/SoftReference.html?is-external=true" title="class or interface in java.lang.ref"><code>SoftReference</code></a> 151 to a <a href="../../../../org/codehaus/jackson/util/BufferRecycler.html" title="class in org.codehaus.jackson.util"><code>BufferRecycler</code></a> used to provide a low-cost 152 buffer recycling between reader and writer instances.</div> 153</td> 154</tr> 155</table> 156</li> 157</ul> 158<!-- ======== CONSTRUCTOR SUMMARY ======== --> 159<ul class="blockList"> 160<li class="blockList"><a name="constructor_summary"> 161<!-- --> 162</a> 163<h3>Constructor Summary</h3> 164<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> 165<caption><span>Constructors</span><span class="tabEnd"> </span></caption> 166<tr> 167<th class="colOne" scope="col">Constructor and Description</th> 168</tr> 169<tr class="altColor"> 170<td class="colOne"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#JsonStringEncoder()">JsonStringEncoder</a></strong>()</code> </td> 171</tr> 172</table> 173</li> 174</ul> 175<!-- ========== METHOD SUMMARY =========== --> 176<ul class="blockList"> 177<li class="blockList"><a name="method_summary"> 178<!-- --> 179</a> 180<h3>Method Summary</h3> 181<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> 182<caption><span>Methods</span><span class="tabEnd"> </span></caption> 183<tr> 184<th class="colFirst" scope="col">Modifier and Type</th> 185<th class="colLast" scope="col">Method and Description</th> 186</tr> 187<tr class="altColor"> 188<td class="colFirst"><code>byte[]</code></td> 189<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#encodeAsUTF8(java.lang.String)">encodeAsUTF8</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> text)</code> 190<div class="block">Will encode given String as UTF-8 (without any quoting), return 191 resulting byte array.</div> 192</td> 193</tr> 194<tr class="rowColor"> 195<td class="colFirst"><code>static <a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html" title="class in org.codehaus.jackson.io">JsonStringEncoder</a></code></td> 196<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#getInstance()">getInstance</a></strong>()</code> 197<div class="block">Factory method for getting an instance; this is either recycled per-thread instance, 198 or a newly constructed one.</div> 199</td> 200</tr> 201<tr class="altColor"> 202<td class="colFirst"><code>char[]</code></td> 203<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#quoteAsString(java.lang.String)">quoteAsString</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> input)</code> 204<div class="block">Method that will quote text contents using JSON standard quoting, 205 and return results as a character array</div> 206</td> 207</tr> 208<tr class="rowColor"> 209<td class="colFirst"><code>byte[]</code></td> 210<td class="colLast"><code><strong><a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html#quoteAsUTF8(java.lang.String)">quoteAsUTF8</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> text)</code> 211<div class="block">Will quote given JSON String value using standard quoting, encode 212 results as UTF-8, and return result as a byte array.</div> 213</td> 214</tr> 215</table> 216<ul class="blockList"> 217<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> 218<!-- --> 219</a> 220<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> 221<code><a href="http://docs.oracle.com/javase/6/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/6/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/6/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/6/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/6/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/6/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/6/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/6/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/6/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/6/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/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> 222</ul> 223</li> 224</ul> 225</li> 226</ul> 227</div> 228<div class="details"> 229<ul class="blockList"> 230<li class="blockList"> 231<!-- ============ FIELD DETAIL =========== --> 232<ul class="blockList"> 233<li class="blockList"><a name="field_detail"> 234<!-- --> 235</a> 236<h3>Field Detail</h3> 237<a name="_threadEncoder"> 238<!-- --> 239</a> 240<ul class="blockList"> 241<li class="blockList"> 242<h4>_threadEncoder</h4> 243<pre>protected static final <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang">ThreadLocal</a><<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ref/SoftReference.html?is-external=true" title="class or interface in java.lang.ref">SoftReference</a><<a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html" title="class in org.codehaus.jackson.io">JsonStringEncoder</a>>> _threadEncoder</pre> 244<div class="block">This <code>ThreadLocal</code> contains a <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ref/SoftReference.html?is-external=true" title="class or interface in java.lang.ref"><code>SoftReference</code></a> 245 to a <a href="../../../../org/codehaus/jackson/util/BufferRecycler.html" title="class in org.codehaus.jackson.util"><code>BufferRecycler</code></a> used to provide a low-cost 246 buffer recycling between reader and writer instances.</div> 247</li> 248</ul> 249<a name="_textBuffer"> 250<!-- --> 251</a> 252<ul class="blockList"> 253<li class="blockList"> 254<h4>_textBuffer</h4> 255<pre>protected <a href="../../../../org/codehaus/jackson/util/TextBuffer.html" title="class in org.codehaus.jackson.util">TextBuffer</a> _textBuffer</pre> 256<div class="block">Lazily constructed text buffer used to produce JSON encoded Strings 257 as characters (without UTF-8 encoding)</div> 258</li> 259</ul> 260<a name="_byteBuilder"> 261<!-- --> 262</a> 263<ul class="blockList"> 264<li class="blockList"> 265<h4>_byteBuilder</h4> 266<pre>protected <a href="../../../../org/codehaus/jackson/util/ByteArrayBuilder.html" title="class in org.codehaus.jackson.util">ByteArrayBuilder</a> _byteBuilder</pre> 267<div class="block">Lazily-constructed builder used for UTF-8 encoding of text values 268 (quoted and unquoted)</div> 269</li> 270</ul> 271<a name="_quoteBuffer"> 272<!-- --> 273</a> 274<ul class="blockListLast"> 275<li class="blockList"> 276<h4>_quoteBuffer</h4> 277<pre>protected final char[] _quoteBuffer</pre> 278<div class="block">Temporary buffer used for composing quote/escape sequences</div> 279</li> 280</ul> 281</li> 282</ul> 283<!-- ========= CONSTRUCTOR DETAIL ======== --> 284<ul class="blockList"> 285<li class="blockList"><a name="constructor_detail"> 286<!-- --> 287</a> 288<h3>Constructor Detail</h3> 289<a name="JsonStringEncoder()"> 290<!-- --> 291</a> 292<ul class="blockListLast"> 293<li class="blockList"> 294<h4>JsonStringEncoder</h4> 295<pre>public JsonStringEncoder()</pre> 296</li> 297</ul> 298</li> 299</ul> 300<!-- ============ METHOD DETAIL ========== --> 301<ul class="blockList"> 302<li class="blockList"><a name="method_detail"> 303<!-- --> 304</a> 305<h3>Method Detail</h3> 306<a name="getInstance()"> 307<!-- --> 308</a> 309<ul class="blockList"> 310<li class="blockList"> 311<h4>getInstance</h4> 312<pre>public static <a href="../../../../org/codehaus/jackson/io/JsonStringEncoder.html" title="class in org.codehaus.jackson.io">JsonStringEncoder</a> getInstance()</pre> 313<div class="block">Factory method for getting an instance; this is either recycled per-thread instance, 314 or a newly constructed one.</div> 315</li> 316</ul> 317<a name="quoteAsString(java.lang.String)"> 318<!-- --> 319</a> 320<ul class="blockList"> 321<li class="blockList"> 322<h4>quoteAsString</h4> 323<pre>public char[] quoteAsString(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> input)</pre> 324<div class="block">Method that will quote text contents using JSON standard quoting, 325 and return results as a character array</div> 326</li> 327</ul> 328<a name="quoteAsUTF8(java.lang.String)"> 329<!-- --> 330</a> 331<ul class="blockList"> 332<li class="blockList"> 333<h4>quoteAsUTF8</h4> 334<pre>public byte[] quoteAsUTF8(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> text)</pre> 335<div class="block">Will quote given JSON String value using standard quoting, encode 336 results as UTF-8, and return result as a byte array.</div> 337</li> 338</ul> 339<a name="encodeAsUTF8(java.lang.String)"> 340<!-- --> 341</a> 342<ul class="blockListLast"> 343<li class="blockList"> 344<h4>encodeAsUTF8</h4> 345<pre>public byte[] encodeAsUTF8(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> text)</pre> 346<div class="block">Will encode given String as UTF-8 (without any quoting), return 347 resulting byte array.</div> 348</li> 349</ul> 350</li> 351</ul> 352</li> 353</ul> 354</div> 355</div> 356<!-- ========= END OF CLASS DATA ========= --> 357<!-- ======= START OF BOTTOM NAVBAR ====== --> 358<div class="bottomNav"><a name="navbar_bottom"> 359<!-- --> 360</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> 361<!-- --> 362</a> 363<ul class="navList" title="Navigation"> 364<li><a href="../../../../overview-summary.html">Overview</a></li> 365<li><a href="package-summary.html">Package</a></li> 366<li class="navBarCell1Rev">Class</li> 367<li><a href="class-use/JsonStringEncoder.html">Use</a></li> 368<li><a href="package-tree.html">Tree</a></li> 369<li><a href="../../../../deprecated-list.html">Deprecated</a></li> 370<li><a href="../../../../index-all.html">Index</a></li> 371<li><a href="../../../../help-doc.html">Help</a></li> 372</ul> 373</div> 374<div class="subNav"> 375<ul class="navList"> 376<li><a href="../../../../org/codehaus/jackson/io/IOContext.html" title="class in org.codehaus.jackson.io"><span class="strong">Prev Class</span></a></li> 377<li><a href="../../../../org/codehaus/jackson/io/MergedStream.html" title="class in org.codehaus.jackson.io"><span class="strong">Next Class</span></a></li> 378</ul> 379<ul class="navList"> 380<li><a href="../../../../index.html?org/codehaus/jackson/io/JsonStringEncoder.html" target="_top">Frames</a></li> 381<li><a href="JsonStringEncoder.html" target="_top">No Frames</a></li> 382</ul> 383<ul class="navList" id="allclasses_navbar_bottom"> 384<li><a href="../../../../allclasses-noframe.html">All Classes</a></li> 385</ul> 386<div> 387<script type="text/javascript"><!-- 388 allClassesLink = document.getElementById("allclasses_navbar_bottom"); 389 if(window==top) { 390 allClassesLink.style.display = "block"; 391 } 392 else { 393 allClassesLink.style.display = "none"; 394 } 395 //--> 396</script> 397</div> 398<div> 399<ul class="subNavList"> 400<li>Summary: </li> 401<li>Nested | </li> 402<li><a href="#field_summary">Field</a> | </li> 403<li><a href="#constructor_summary">Constr</a> | </li> 404<li><a href="#method_summary">Method</a></li> 405</ul> 406<ul class="subNavList"> 407<li>Detail: </li> 408<li><a href="#field_detail">Field</a> | </li> 409<li><a href="#constructor_detail">Constr</a> | </li> 410<li><a href="#method_detail">Method</a></li> 411</ul> 412</div> 413<a name="skip-navbar_bottom"> 414<!-- --> 415</a></div> 416<!-- ======== END OF BOTTOM NAVBAR ======= --> 417</body> 418</html> 419