5 <title>JSDoc: Class: Message</title>
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
20 <h1 class="page-title">Class: Message</h1>
32 <span class="ancestors"><a href="ProtoBuf.html">ProtoBuf</a><a href="ProtoBuf.Builder.html">.Builder</a>.</span>
37 <div class="class-description"><p>Barebone of all runtime messages.</p></div>
43 <div class="container-overview">
51 <h4 class="name" id="Message"><span class="type-signature"></span>new Message<span class="signature">(values, …var_args)</span><span class="type-signature"></span></h4>
57 <div class="description">
58 <p>Constructs a new runtime Message.</p>
72 <table class="params">
87 <th class="last">Description</th>
96 <td class="name"><code>values</code></td>
102 <span class="param-type">!Object.<string, *></span>
105 <span class="param-type">string</span>
112 <td class="attributes">
123 <td class="description last"><p>Preset values</p></td>
130 <td class="name"><code>var_args</code></td>
136 <span class="param-type">string</span>
143 <td class="attributes">
156 <td class="description last"></td>
195 <dt class="tag-source">Source:</dt>
196 <dd class="tag-source"><ul class="dummy"><li>
197 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2375">line 2375</a>
224 <div class="param-desc">
225 <p>If the message cannot be created</p>
236 <span class="param-type">Error</span>
266 <h3 class="subsection-title">Members</h3>
270 <h4 class="name" id=".$options"><span class="type-signature">(static) </span>$options<span class="type-signature"> :Object.<string, *></span></h4>
275 <div class="description">
276 <p>Message options.</p>
285 <span class="param-type">Object.<string, *></span>
322 <dt class="tag-source">Source:</dt>
323 <dd class="tag-source"><ul class="dummy"><li>
324 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3052">line 3052</a>
342 <h4 class="name" id=".$type"><span class="type-signature">(static, non-null) </span>$type<span class="type-signature"> :<a href="ProtoBuf.Reflect.Message.html">ProtoBuf.Reflect.Message</a></span></h4>
347 <div class="description">
348 <p>Reflection type.</p>
357 <span class="param-type"><a href="ProtoBuf.Reflect.Message.html">ProtoBuf.Reflect.Message</a></span>
394 <dt class="tag-source">Source:</dt>
395 <dd class="tag-source"><ul class="dummy"><li>
396 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3068">line 3068</a>
414 <h4 class="name" id="$options"><span class="type-signature"></span>$options<span class="type-signature"> :Object.<string, *></span></h4>
419 <div class="description">
420 <p>Message options.</p>
429 <span class="param-type">Object.<string, *></span>
466 <dt class="tag-source">Source:</dt>
467 <dd class="tag-source"><ul class="dummy"><li>
468 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3060">line 3060</a>
486 <h4 class="name" id="$type"><span class="type-signature">(non-null) </span>$type<span class="type-signature"> :<a href="ProtoBuf.Reflect.Message.html">ProtoBuf.Reflect.Message</a></span></h4>
491 <div class="description">
492 <p>Reflection type.</p>
501 <span class="param-type"><a href="ProtoBuf.Reflect.Message.html">ProtoBuf.Reflect.Message</a></span>
538 <dt class="tag-source">Source:</dt>
539 <dd class="tag-source"><ul class="dummy"><li>
540 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3076">line 3076</a>
560 <h3 class="subsection-title">Methods</h3>
567 <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buffer, length<span class="signature-attributes">opt</span>, enc<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
573 <div class="description">
574 <p>Decodes a message from the specified buffer or string.</p>
588 <table class="params">
603 <th class="last">Description</th>
612 <td class="name"><code>buffer</code></td>
618 <span class="param-type">ByteBuffer</span>
621 <span class="param-type">ArrayBuffer</span>
624 <span class="param-type">Buffer</span>
627 <span class="param-type">string</span>
634 <td class="attributes">
645 <td class="description last"><p>Buffer to decode from</p></td>
652 <td class="name"><code>length</code></td>
658 <span class="param-type">number</span>
661 <span class="param-type">string</span>
668 <td class="attributes">
681 <td class="description last"><p>Message length. Defaults to decode all the remainig data.</p></td>
688 <td class="name"><code>enc</code></td>
694 <span class="param-type">string</span>
701 <td class="attributes">
714 <td class="description last"><p>Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64</p></td>
753 <dt class="tag-source">Source:</dt>
754 <dd class="tag-source"><ul class="dummy"><li>
755 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2928">line 2928</a>
762 <dt class="tag-see">See:</dt>
765 <li><a href="ProtoBuf.Builder.Message.html#.decode64">ProtoBuf.Builder.Message.decode64</a></li>
767 <li><a href="ProtoBuf.Builder.Message.html#.decodeHex">ProtoBuf.Builder.Message.decodeHex</a></li>
791 <div class="param-desc">
792 <p>If the message cannot be decoded or if required fields are missing. The later still
793 returns the decoded message with missing fields in the <code>decoded</code> property on the error.</p>
804 <span class="param-type">Error</span>
820 <div class="param-desc">
821 <p>Decoded message</p>
832 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
847 <h4 class="name" id=".decode64"><span class="type-signature">(static) </span>decode64<span class="signature">(str)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
853 <div class="description">
854 <p>Decodes the message from the specified base64 encoded string.</p>
868 <table class="params">
881 <th class="last">Description</th>
890 <td class="name"><code>str</code></td>
896 <span class="param-type">string</span>
906 <td class="description last"><p>String to decode from</p></td>
945 <dt class="tag-source">Source:</dt>
946 <dd class="tag-source"><ul class="dummy"><li>
947 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2995">line 2995</a>
974 <div class="param-desc">
975 <p>If the message cannot be decoded or if required fields are missing. The later still
976 returns the decoded message with missing fields in the <code>decoded</code> property on the error.</p>
987 <span class="param-type">Error</span>
1003 <div class="param-desc">
1004 <p>Decoded message</p>
1015 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
1030 <h4 class="name" id=".decodeDelimited"><span class="type-signature">(static) </span>decodeDelimited<span class="signature">(buffer, enc<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
1036 <div class="description">
1037 <p>Decodes a varint32 length-delimited message from the specified buffer or string.</p>
1048 <h5>Parameters:</h5>
1051 <table class="params">
1066 <th class="last">Description</th>
1075 <td class="name"><code>buffer</code></td>
1081 <span class="param-type">ByteBuffer</span>
1084 <span class="param-type">ArrayBuffer</span>
1087 <span class="param-type">Buffer</span>
1090 <span class="param-type">string</span>
1097 <td class="attributes">
1108 <td class="description last"><p>Buffer to decode from</p></td>
1115 <td class="name"><code>enc</code></td>
1121 <span class="param-type">string</span>
1128 <td class="attributes">
1141 <td class="description last"><p>Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64</p></td>
1153 <dl class="details">
1180 <dt class="tag-source">Source:</dt>
1181 <dd class="tag-source"><ul class="dummy"><li>
1182 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2961">line 2961</a>
1209 <div class="param-desc">
1210 <p>If the message cannot be decoded or if required fields are missing. The later still
1211 returns the decoded message with missing fields in the <code>decoded</code> property on the error.</p>
1222 <span class="param-type">Error</span>
1238 <div class="param-desc">
1239 <p>Decoded message or <code>null</code> if not enough bytes are available yet</p>
1250 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
1265 <h4 class="name" id=".decodeHex"><span class="type-signature">(static) </span>decodeHex<span class="signature">(str)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
1271 <div class="description">
1272 <p>Decodes the message from the specified hex encoded string.</p>
1283 <h5>Parameters:</h5>
1286 <table class="params">
1299 <th class="last">Description</th>
1308 <td class="name"><code>str</code></td>
1314 <span class="param-type">string</span>
1324 <td class="description last"><p>String to decode from</p></td>
1336 <dl class="details">
1363 <dt class="tag-source">Source:</dt>
1364 <dd class="tag-source"><ul class="dummy"><li>
1365 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3009">line 3009</a>
1392 <div class="param-desc">
1393 <p>If the message cannot be decoded or if required fields are missing. The later still
1394 returns the decoded message with missing fields in the <code>decoded</code> property on the error.</p>
1405 <span class="param-type">Error</span>
1421 <div class="param-desc">
1422 <p>Decoded message</p>
1433 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
1448 <h4 class="name" id=".decodeJSON"><span class="type-signature">(static) </span>decodeJSON<span class="signature">(str)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
1454 <div class="description">
1455 <p>Decodes the message from a JSON string.</p>
1466 <h5>Parameters:</h5>
1469 <table class="params">
1482 <th class="last">Description</th>
1491 <td class="name"><code>str</code></td>
1497 <span class="param-type">string</span>
1507 <td class="description last"><p>String to decode from</p></td>
1519 <dl class="details">
1546 <dt class="tag-source">Source:</dt>
1547 <dd class="tag-source"><ul class="dummy"><li>
1548 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3023">line 3023</a>
1575 <div class="param-desc">
1576 <p>If the message cannot be decoded or if required fields are
1588 <span class="param-type">Error</span>
1604 <div class="param-desc">
1605 <p>Decoded message</p>
1616 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
1631 <h4 class="name" id="$add"><span class="type-signature"></span>$add<span class="signature">(key, value, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
1637 <div class="description">
1638 <p>Adds a value to a repeated field. This is an alias for <a href="ProtoBuf.Builder.Message.html#add">ProtoBuf.Builder.Message#add</a>.</p>
1649 <h5>Parameters:</h5>
1652 <table class="params">
1667 <th class="last">Description</th>
1676 <td class="name"><code>key</code></td>
1682 <span class="param-type">string</span>
1689 <td class="attributes">
1700 <td class="description last"><p>Field name</p></td>
1707 <td class="name"><code>value</code></td>
1713 <span class="param-type">*</span>
1720 <td class="attributes">
1731 <td class="description last"><p>Value to add</p></td>
1738 <td class="name"><code>noAssert</code></td>
1744 <span class="param-type">boolean</span>
1751 <td class="attributes">
1764 <td class="description last"><p>Whether to assert the value or not (asserts by default)</p></td>
1776 <dl class="details">
1803 <dt class="tag-source">Source:</dt>
1804 <dd class="tag-source"><ul class="dummy"><li>
1805 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2453">line 2453</a>
1832 <div class="param-desc">
1833 <p>If the value cannot be added</p>
1844 <span class="param-type">Error</span>
1860 <div class="param-desc">
1872 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
1887 <h4 class="name" id="$encode"><span class="type-signature"></span>$encode<span class="signature">(buffer<span class="signature-attributes">opt</span>, noVerify<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {ByteBuffer}</span></h4>
1893 <div class="description">
1894 <p>Encodes the message.</p>
1905 <h5>Parameters:</h5>
1908 <table class="params">
1923 <th class="last">Description</th>
1932 <td class="name"><code>buffer</code></td>
1938 <span class="param-type">ByteBuffer</span>
1941 <span class="param-type">boolean</span>
1948 <td class="attributes">
1961 <td class="description last"><p>ByteBuffer to encode to. Will create a new one and flip it if omitted.</p></td>
1968 <td class="name"><code>noVerify</code></td>
1974 <span class="param-type">boolean</span>
1981 <td class="attributes">
1994 <td class="description last"><p>Whether to not verify field values, defaults to <code>false</code></p></td>
2006 <dl class="details">
2033 <dt class="tag-source">Source:</dt>
2034 <dd class="tag-source"><ul class="dummy"><li>
2035 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2651">line 2651</a>
2042 <dt class="tag-see">See:</dt>
2043 <dd class="tag-see">
2045 <li><a href="ProtoBuf.Builder.Message.html#encode64">ProtoBuf.Builder.Message#encode64</a></li>
2047 <li><a href="ProtoBuf.Builder.Message.html#encodeHex">ProtoBuf.Builder.Message#encodeHex</a></li>
2049 <li><a href="ProtoBuf.Builder.Message.html#encodeAB">ProtoBuf.Builder.Message#encodeAB</a></li>
2073 <div class="param-desc">
2074 <p>If the message cannot be encoded or if required fields are missing. The later still
2075 returns the encoded ByteBuffer in the <code>encoded</code> property on the error.</p>
2086 <span class="param-type">Error</span>
2102 <div class="param-desc">
2103 <p>Encoded message as a ByteBuffer</p>
2114 <span class="param-type">ByteBuffer</span>
2129 <h4 class="name" id="$get"><span class="type-signature"></span>$get<span class="signature">(key)</span><span class="type-signature"> → {*}</span></h4>
2135 <div class="description">
2136 <p>Gets a field's value. This is an alias for <a href="ProtoBuf.Builder.Message.html#$get">ProtoBuf.Builder.Message#$get</a>.</p>
2147 <h5>Parameters:</h5>
2150 <table class="params">
2163 <th class="last">Description</th>
2172 <td class="name"><code>key</code></td>
2178 <span class="param-type">string</span>
2188 <td class="description last"><p>Key</p></td>
2200 <dl class="details">
2227 <dt class="tag-source">Source:</dt>
2228 <dd class="tag-source"><ul class="dummy"><li>
2229 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2541">line 2541</a>
2256 <div class="param-desc">
2257 <p>If there is no such field</p>
2268 <span class="param-type">Error</span>
2284 <div class="param-desc">
2296 <span class="param-type">*</span>
2311 <h4 class="name" id="$set"><span class="type-signature"></span>$set<span class="signature">(keyOrObj, value<span class="signature-attributes">opt</span>, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
2317 <div class="description">
2318 <p>Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.</p>
2329 <h5>Parameters:</h5>
2332 <table class="params">
2347 <th class="last">Description</th>
2356 <td class="name"><code>keyOrObj</code></td>
2362 <span class="param-type">string</span>
2365 <span class="param-type">!Object.<string, *></span>
2372 <td class="attributes">
2383 <td class="description last"><p>String key or plain object holding multiple values</p></td>
2390 <td class="name"><code>value</code></td>
2396 <span class="param-type">*</span>
2399 <span class="param-type">boolean</span>
2406 <td class="attributes">
2419 <td class="description last"><p>Value to set if key is a string, otherwise omitted</p></td>
2426 <td class="name"><code>noAssert</code></td>
2432 <span class="param-type">boolean</span>
2439 <td class="attributes">
2452 <td class="description last"><p>Whether to not assert the value, defaults to <code>false</code></p></td>
2464 <dl class="details">
2491 <dt class="tag-source">Source:</dt>
2492 <dd class="tag-source"><ul class="dummy"><li>
2493 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2508">line 2508</a>
2520 <div class="param-desc">
2521 <p>If the value cannot be set</p>
2532 <span class="param-type">Error</span>
2553 <h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(key, value, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
2559 <div class="description">
2560 <p>Adds a value to a repeated field.</p>
2571 <h5>Parameters:</h5>
2574 <table class="params">
2589 <th class="last">Description</th>
2598 <td class="name"><code>key</code></td>
2604 <span class="param-type">string</span>
2611 <td class="attributes">
2622 <td class="description last"><p>Field name</p></td>
2629 <td class="name"><code>value</code></td>
2635 <span class="param-type">*</span>
2642 <td class="attributes">
2653 <td class="description last"><p>Value to add</p></td>
2660 <td class="name"><code>noAssert</code></td>
2666 <span class="param-type">boolean</span>
2673 <td class="attributes">
2686 <td class="description last"><p>Whether to assert the value or not (asserts by default)</p></td>
2698 <dl class="details">
2725 <dt class="tag-source">Source:</dt>
2726 <dd class="tag-source"><ul class="dummy"><li>
2727 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2425">line 2425</a>
2754 <div class="param-desc">
2755 <p>If the value cannot be added</p>
2766 <span class="param-type">Error</span>
2782 <div class="param-desc">
2794 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
2809 <h4 class="name" id="calculate"><span class="type-signature"></span>calculate<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
2815 <div class="description">
2816 <p>Calculates the byte length of the message.</p>
2831 <dl class="details">
2858 <dt class="tag-source">Source:</dt>
2859 <dd class="tag-source"><ul class="dummy"><li>
2860 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2695">line 2695</a>
2887 <div class="param-desc">
2888 <p>If the message cannot be calculated or if required fields are missing.</p>
2899 <span class="param-type">Error</span>
2915 <div class="param-desc">
2927 <span class="param-type">number</span>
2942 <h4 class="name" id="encode64"><span class="type-signature"></span>encode64<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
2948 <div class="description">
2949 <p>Directly encodes the message to a base64 encoded string.</p>
2964 <dl class="details">
2991 <dt class="tag-source">Source:</dt>
2992 <dd class="tag-source"><ul class="dummy"><li>
2993 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2788">line 2788</a>
3020 <div class="param-desc">
3021 <p>If the underlying buffer cannot be encoded or if required fields are missing. The later
3022 still returns the encoded base64 string in the <code>encoded</code> property on the error.</p>
3033 <span class="param-type">Error</span>
3049 <div class="param-desc">
3050 <p>Base64 encoded string</p>
3061 <span class="param-type">string</span>
3076 <h4 class="name" id="encodeAB"><span class="type-signature"></span>encodeAB<span class="signature">()</span><span class="type-signature"> → {ArrayBuffer}</span></h4>
3082 <div class="description">
3083 <p>Directly encodes the message to an ArrayBuffer.</p>
3098 <dl class="details">
3125 <dt class="tag-source">Source:</dt>
3126 <dd class="tag-source"><ul class="dummy"><li>
3127 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2730">line 2730</a>
3154 <div class="param-desc">
3155 <p>If the message cannot be encoded or if required fields are missing. The later still
3156 returns the encoded ArrayBuffer in the <code>encoded</code> property on the error.</p>
3167 <span class="param-type">Error</span>
3183 <div class="param-desc">
3184 <p>Encoded message as ArrayBuffer</p>
3195 <span class="param-type">ArrayBuffer</span>
3210 <h4 class="name" id="encodeDelimited"><span class="type-signature"></span>encodeDelimited<span class="signature">(buffer<span class="signature-attributes">opt</span>, noVerify<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {ByteBuffer}</span></h4>
3216 <div class="description">
3217 <p>Encodes the varint32 length-delimited message.</p>
3228 <h5>Parameters:</h5>
3231 <table class="params">
3246 <th class="last">Description</th>
3255 <td class="name"><code>buffer</code></td>
3261 <span class="param-type">ByteBuffer</span>
3264 <span class="param-type">boolean</span>
3271 <td class="attributes">
3284 <td class="description last"><p>ByteBuffer to encode to. Will create a new one and flip it if omitted.</p></td>
3291 <td class="name"><code>noVerify</code></td>
3297 <span class="param-type">boolean</span>
3304 <td class="attributes">
3317 <td class="description last"><p>Whether to not verify field values, defaults to <code>false</code></p></td>
3329 <dl class="details">
3356 <dt class="tag-source">Source:</dt>
3357 <dd class="tag-source"><ul class="dummy"><li>
3358 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2707">line 2707</a>
3385 <div class="param-desc">
3386 <p>If the message cannot be encoded or if required fields are missing. The later still
3387 returns the encoded ByteBuffer in the <code>encoded</code> property on the error.</p>
3398 <span class="param-type">Error</span>
3414 <div class="param-desc">
3415 <p>Encoded message as a ByteBuffer</p>
3426 <span class="param-type">ByteBuffer</span>
3441 <h4 class="name" id="encodeHex"><span class="type-signature"></span>encodeHex<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
3447 <div class="description">
3448 <p>Directly encodes the message to a hex encoded string.</p>
3463 <dl class="details">
3490 <dt class="tag-source">Source:</dt>
3491 <dd class="tag-source"><ul class="dummy"><li>
3492 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2817">line 2817</a>
3519 <div class="param-desc">
3520 <p>If the underlying buffer cannot be encoded or if required fields are missing. The later
3521 still returns the encoded hex string in the <code>encoded</code> property on the error.</p>
3532 <span class="param-type">Error</span>
3548 <div class="param-desc">
3549 <p>Hex encoded string</p>
3560 <span class="param-type">string</span>
3575 <h4 class="name" id="encodeJSON"><span class="type-signature"></span>encodeJSON<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
3581 <div class="description">
3582 <p>Encodes a message to JSON.</p>
3597 <dl class="details">
3624 <dt class="tag-source">Source:</dt>
3625 <dd class="tag-source"><ul class="dummy"><li>
3626 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2918">line 2918</a>
3652 <div class="param-desc">
3664 <span class="param-type">string</span>
3679 <h4 class="name" id="encodeNB"><span class="type-signature"></span>encodeNB<span class="signature">()</span><span class="type-signature"> → (non-null) {Buffer}</span></h4>
3685 <div class="description">
3686 <p>Directly encodes the message to a node Buffer.</p>
3701 <dl class="details">
3728 <dt class="tag-source">Source:</dt>
3729 <dd class="tag-source"><ul class="dummy"><li>
3730 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2759">line 2759</a>
3757 <div class="param-desc">
3758 <p>If the message cannot be encoded, not running under node.js or if required fields are
3759 missing. The later still returns the encoded node Buffer in the <code>encoded</code> property on the error.</p>
3770 <span class="param-type">Error</span>
3794 <span class="param-type">Buffer</span>
3809 <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(key, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
3815 <div class="description">
3816 <p>Gets a field's value.</p>
3827 <h5>Parameters:</h5>
3830 <table class="params">
3845 <th class="last">Description</th>
3854 <td class="name"><code>key</code></td>
3860 <span class="param-type">string</span>
3867 <td class="attributes">
3878 <td class="description last"><p>Key</p></td>
3885 <td class="name"><code>noAssert</code></td>
3891 <span class="param-type">boolean</span>
3898 <td class="attributes">
3911 <td class="description last"><p>Whether to not assert for an actual field, defaults to <code>false</code></p></td>
3923 <dl class="details">
3950 <dt class="tag-source">Source:</dt>
3951 <dd class="tag-source"><ul class="dummy"><li>
3952 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2520">line 2520</a>
3979 <div class="param-desc">
3980 <p>If there is no such field</p>
3991 <span class="param-type">Error</span>
4007 <div class="param-desc">
4019 <span class="param-type">*</span>
4034 <h4 class="name" id="get%5BSomeField%5D"><span class="type-signature">(abstract) </span>get[SomeField]<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
4040 <div class="description">
4041 <p>Gets a value. This method is present for each field, but only if there is no name conflict with
4057 <dl class="details">
4084 <dt class="tag-source">Source:</dt>
4085 <dd class="tag-source"><ul class="dummy"><li>
4086 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2625">line 2625</a>
4112 <div class="param-desc">
4124 <span class="param-type">*</span>
4139 <h4 class="name" id="get_%5Bsome_field%5D"><span class="type-signature">(abstract) </span>get_[some_field]<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
4145 <div class="description">
4146 <p>Gets a value. This method is present for each field, but only if there is no name conflict with
4162 <dl class="details">
4189 <dt class="tag-source">Source:</dt>
4190 <dd class="tag-source"><ul class="dummy"><li>
4191 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2636">line 2636</a>
4217 <div class="param-desc">
4229 <span class="param-type">*</span>
4244 <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(keyOrObj, value<span class="signature-attributes">opt</span>, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
4250 <div class="description">
4251 <p>Sets a field's value.</p>
4262 <h5>Parameters:</h5>
4265 <table class="params">
4280 <th class="last">Description</th>
4289 <td class="name"><code>keyOrObj</code></td>
4295 <span class="param-type">string</span>
4298 <span class="param-type">!Object.<string, *></span>
4305 <td class="attributes">
4316 <td class="description last"><p>String key or plain object holding multiple values</p></td>
4323 <td class="name"><code>value</code></td>
4329 <span class="param-type">*</span>
4332 <span class="param-type">boolean</span>
4339 <td class="attributes">
4352 <td class="description last"><p>Value to set if key is a string, otherwise omitted</p></td>
4359 <td class="name"><code>noAssert</code></td>
4365 <span class="param-type">boolean</span>
4372 <td class="attributes">
4385 <td class="description last"><p>Whether to not assert for an actual field / proper value type, defaults to <code>false</code></p></td>
4397 <dl class="details">
4424 <dt class="tag-source">Source:</dt>
4425 <dd class="tag-source"><ul class="dummy"><li>
4426 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2466">line 2466</a>
4453 <div class="param-desc">
4454 <p>If the value cannot be set</p>
4465 <span class="param-type">Error</span>
4481 <div class="param-desc">
4493 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
4508 <h4 class="name" id="set%5BSomeField%5D"><span class="type-signature">(abstract) </span>set[SomeField]<span class="signature">(value, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
4514 <div class="description">
4515 <p>Sets a value. This method is present for each field, but only if there is no name conflict with
4527 <h5>Parameters:</h5>
4530 <table class="params">
4545 <th class="last">Description</th>
4554 <td class="name"><code>value</code></td>
4560 <span class="param-type">*</span>
4567 <td class="attributes">
4578 <td class="description last"><p>Value to set</p></td>
4585 <td class="name"><code>noAssert</code></td>
4591 <span class="param-type">boolean</span>
4598 <td class="attributes">
4611 <td class="description last"><p>Whether to not assert the value, defaults to <code>false</code></p></td>
4623 <dl class="details">
4650 <dt class="tag-source">Source:</dt>
4651 <dd class="tag-source"><ul class="dummy"><li>
4652 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2597">line 2597</a>
4679 <div class="param-desc">
4680 <p>If the value cannot be set</p>
4691 <span class="param-type">Error</span>
4707 <div class="param-desc">
4719 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
4734 <h4 class="name" id="set_%5Bsome_field%5D"><span class="type-signature">(abstract) </span>set_[some_field]<span class="signature">(value, noAssert<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>}</span></h4>
4740 <div class="description">
4741 <p>Sets a value. This method is present for each field, but only if there is no name conflict with
4753 <h5>Parameters:</h5>
4756 <table class="params">
4771 <th class="last">Description</th>
4780 <td class="name"><code>value</code></td>
4786 <span class="param-type">*</span>
4793 <td class="attributes">
4804 <td class="description last"><p>Value to set</p></td>
4811 <td class="name"><code>noAssert</code></td>
4817 <span class="param-type">boolean</span>
4824 <td class="attributes">
4837 <td class="description last"><p>Whether to not assert the value, defaults to <code>false</code></p></td>
4849 <dl class="details">
4876 <dt class="tag-source">Source:</dt>
4877 <dd class="tag-source"><ul class="dummy"><li>
4878 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2611">line 2611</a>
4905 <div class="param-desc">
4906 <p>If the value cannot be set</p>
4917 <span class="param-type">Error</span>
4933 <div class="param-desc">
4945 <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span>
4960 <h4 class="name" id="toArrayBuffer"><span class="type-signature"></span>toArrayBuffer<span class="signature">()</span><span class="type-signature"> → {ArrayBuffer}</span></h4>
4966 <div class="description">
4967 <p>Returns the message as an ArrayBuffer. This is an alias for <a href="ProtoBuf.Builder.Message.html#encodeAB">ProtoBuf.Builder.Message#encodeAB</a>.</p>
4982 <dl class="details">
5009 <dt class="tag-source">Source:</dt>
5010 <dd class="tag-source"><ul class="dummy"><li>
5011 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2748">line 2748</a>
5038 <div class="param-desc">
5039 <p>If the message cannot be encoded or if required fields are missing. The later still
5040 returns the encoded ArrayBuffer in the <code>encoded</code> property on the error.</p>
5051 <span class="param-type">Error</span>
5067 <div class="param-desc">
5068 <p>Encoded message as ArrayBuffer</p>
5079 <span class="param-type">ArrayBuffer</span>
5094 <h4 class="name" id="toBase64"><span class="type-signature"></span>toBase64<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
5100 <div class="description">
5101 <p>Returns the message as a base64 encoded string. This is an alias for <a href="ProtoBuf.Builder.Message.html#encode64">ProtoBuf.Builder.Message#encode64</a>.</p>
5116 <dl class="details">
5143 <dt class="tag-source">Source:</dt>
5144 <dd class="tag-source"><ul class="dummy"><li>
5145 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2806">line 2806</a>
5172 <div class="param-desc">
5173 <p>If the message cannot be encoded or if required fields are missing. The later still
5174 returns the encoded base64 string in the <code>encoded</code> property on the error.</p>
5185 <span class="param-type">Error</span>
5201 <div class="param-desc">
5202 <p>Base64 encoded string</p>
5213 <span class="param-type">string</span>
5228 <h4 class="name" id="toBuffer"><span class="type-signature"></span>toBuffer<span class="signature">()</span><span class="type-signature"> → (non-null) {Buffer}</span></h4>
5234 <div class="description">
5235 <p>Returns the message as a node Buffer. This is an alias for <a href="ProtoBuf.Builder.Message.html#encodeNB">ProtoBuf.Builder.Message#encodeNB</a>.</p>
5250 <dl class="details">
5277 <dt class="tag-source">Source:</dt>
5278 <dd class="tag-source"><ul class="dummy"><li>
5279 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2777">line 2777</a>
5306 <div class="param-desc">
5307 <p>If the message cannot be encoded or if required fields are missing. The later still
5308 returns the encoded node Buffer in the <code>encoded</code> property on the error.</p>
5319 <span class="param-type">Error</span>
5343 <span class="param-type">Buffer</span>
5358 <h4 class="name" id="toHex"><span class="type-signature"></span>toHex<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
5364 <div class="description">
5365 <p>Returns the message as a hex encoded string. This is an alias for <a href="ProtoBuf.Builder.Message.html#encodeHex">ProtoBuf.Builder.Message#encodeHex</a>.</p>
5380 <dl class="details">
5407 <dt class="tag-source">Source:</dt>
5408 <dd class="tag-source"><ul class="dummy"><li>
5409 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2835">line 2835</a>
5436 <div class="param-desc">
5437 <p>If the message cannot be encoded or if required fields are missing. The later still
5438 returns the encoded hex string in the <code>encoded</code> property on the error.</p>
5449 <span class="param-type">Error</span>
5465 <div class="param-desc">
5466 <p>Hex encoded string</p>
5477 <span class="param-type">string</span>
5492 <h4 class="name" id="toRaw"><span class="type-signature"></span>toRaw<span class="signature">(binaryAsBase64<span class="signature-attributes">opt</span>, longsAsStrings)</span><span class="type-signature"> → {Object.<string, *>}</span></h4>
5498 <div class="description">
5499 <p>Returns the message's raw payload.</p>
5510 <h5>Parameters:</h5>
5513 <table class="params">
5528 <th class="last">Description</th>
5537 <td class="name"><code>binaryAsBase64</code></td>
5543 <span class="param-type">boolean</span>
5550 <td class="attributes">
5563 <td class="description last"><p>Whether to include binary data as base64 strings instead of Buffers, defaults to <code>false</code></p></td>
5570 <td class="name"><code>longsAsStrings</code></td>
5576 <span class="param-type">boolean</span>
5583 <td class="attributes">
5594 <td class="description last"><p>Whether to encode longs as strings</p></td>
5606 <dl class="details">
5633 <dt class="tag-source">Source:</dt>
5634 <dd class="tag-source"><ul class="dummy"><li>
5635 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line2909">line 2909</a>
5661 <div class="param-desc">
5673 <span class="param-type">Object.<string, *></span>
5688 <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4>
5694 <div class="description">
5695 <p>Returns a string representation of this Message.</p>
5710 <dl class="details">
5737 <dt class="tag-source">Source:</dt>
5738 <dd class="tag-source"><ul class="dummy"><li>
5739 <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line3039">line 3039</a>
5765 <div class="param-desc">
5766 <p>String representation as of ".Fully.Qualified.MessageName"</p>
5777 <span class="param-type">string</span>
5803 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ProtoBuf.Builder.html">Builder</a></li><li><a href="ProtoBuf.Builder.Message.html">Message</a></li><li><a href="ProtoBuf.Builder.Service.html">Service</a></li><li><a href="ProtoBuf.DotProto.Parser.html">Parser</a></li><li><a href="ProtoBuf.DotProto.Tokenizer.html">Tokenizer</a></li><li><a href="ProtoBuf.Map.html">Map</a></li><li><a href="ProtoBuf.Reflect.Element.html">Element</a></li><li><a href="ProtoBuf.Reflect.Enum.html">Enum</a></li><li><a href="ProtoBuf.Reflect.Enum.Value.html">Value</a></li><li><a href="ProtoBuf.Reflect.Extension.html">Extension</a></li><li><a href="ProtoBuf.Reflect.Message.html">Message</a></li><li><a href="ProtoBuf.Reflect.Message.ExtensionField.html">ExtensionField</a></li><li><a href="ProtoBuf.Reflect.Message.Field.html">Field</a></li><li><a href="ProtoBuf.Reflect.Message.OneOf.html">OneOf</a></li><li><a href="ProtoBuf.Reflect.Namespace.html">Namespace</a></li><li><a href="ProtoBuf.Reflect.Service.html">Service</a></li><li><a href="ProtoBuf.Reflect.Service.Method.html">Method</a></li><li><a href="ProtoBuf.Reflect.Service.RPCMethod.html">RPCMethod</a></li><li><a href="ProtoBuf.Reflect.T.html">T</a></li></ul><h3>Namespaces</h3><ul><li><a href="ProtoBuf.html">ProtoBuf</a></li><li><a href="ProtoBuf.DotProto.html">DotProto</a></li><li><a href="ProtoBuf.Reflect.html">Reflect</a></li><li><a href="ProtoBuf.Util.html">Util</a></li></ul>
5809 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a> on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit)
5812 <script> prettyPrint(); </script>
5813 <script src="scripts/linenumber.js"> </script>