OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 * @return {number} The value of the signed 64-bit integer field. | 737 * @return {number} The value of the signed 64-bit integer field. |
738 */ | 738 */ |
739 jspb.BinaryReader.prototype.readSint64 = function() { | 739 jspb.BinaryReader.prototype.readSint64 = function() { |
740 goog.asserts.assert( | 740 goog.asserts.assert( |
741 this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); | 741 this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); |
742 return this.decoder_.readZigzagVarint64(); | 742 return this.decoder_.readZigzagVarint64(); |
743 }; | 743 }; |
744 | 744 |
745 | 745 |
746 /** | 746 /** |
| 747 * Reads a signed zigzag-encoded 64-bit integer field from the binary stream, |
| 748 * or throws an error if the next field in the stream is not of the correct |
| 749 * wire type. |
| 750 * |
| 751 * @return {string} The value of the signed 64-bit integer field as a decimal st
ring. |
| 752 */ |
| 753 jspb.BinaryReader.prototype.readSint64String = function() { |
| 754 goog.asserts.assert( |
| 755 this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); |
| 756 return this.decoder_.readZigzagVarint64String(); |
| 757 }; |
| 758 |
| 759 |
| 760 /** |
747 * Reads an unsigned 32-bit fixed-length integer fiield from the binary stream, | 761 * Reads an unsigned 32-bit fixed-length integer fiield from the binary stream, |
748 * or throws an error if the next field in the stream is not of the correct | 762 * or throws an error if the next field in the stream is not of the correct |
749 * wire type. | 763 * wire type. |
750 * | 764 * |
751 * @return {number} The value of the double field. | 765 * @return {number} The value of the double field. |
752 */ | 766 */ |
753 jspb.BinaryReader.prototype.readFixed32 = function() { | 767 jspb.BinaryReader.prototype.readFixed32 = function() { |
754 goog.asserts.assert( | 768 goog.asserts.assert( |
755 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 769 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
756 return this.decoder_.readUint32(); | 770 return this.decoder_.readUint32(); |
757 }; | 771 }; |
758 | 772 |
759 | 773 |
760 /** | 774 /** |
761 * Reads an unsigned 64-bit fixed-length integer fiield from the binary stream, | 775 * Reads an unsigned 64-bit fixed-length integer fiield from the binary stream, |
762 * or throws an error if the next field in the stream is not of the correct | 776 * or throws an error if the next field in the stream is not of the correct |
763 * wire type. | 777 * wire type. |
764 * | 778 * |
765 * @return {number} The value of the float field. | 779 * @return {number} The value of the float field. |
766 */ | 780 */ |
767 jspb.BinaryReader.prototype.readFixed64 = function() { | 781 jspb.BinaryReader.prototype.readFixed64 = function() { |
768 goog.asserts.assert( | 782 goog.asserts.assert( |
769 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); | 783 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
770 return this.decoder_.readUint64(); | 784 return this.decoder_.readUint64(); |
771 }; | 785 }; |
772 | 786 |
773 | 787 |
774 /** | 788 /** |
| 789 * Reads a signed 64-bit integer field from the binary stream as a string, or |
| 790 * throws an error if the next field in the stream is not of the correct wire |
| 791 * type. |
| 792 * |
| 793 * Returns the value as a string. |
| 794 * |
| 795 * @return {string} The value of the unsigned 64-bit integer field as a decimal |
| 796 * string. |
| 797 */ |
| 798 jspb.BinaryReader.prototype.readFixed64String = function() { |
| 799 goog.asserts.assert( |
| 800 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
| 801 return this.decoder_.readUint64String(); |
| 802 }; |
| 803 |
| 804 |
| 805 /** |
775 * Reads a signed 32-bit fixed-length integer fiield from the binary stream, or | 806 * Reads a signed 32-bit fixed-length integer fiield from the binary stream, or |
776 * throws an error if the next field in the stream is not of the correct wire | 807 * throws an error if the next field in the stream is not of the correct wire |
777 * type. | 808 * type. |
778 * | 809 * |
779 * @return {number} The value of the double field. | 810 * @return {number} The value of the signed 32-bit integer field. |
780 */ | 811 */ |
781 jspb.BinaryReader.prototype.readSfixed32 = function() { | 812 jspb.BinaryReader.prototype.readSfixed32 = function() { |
782 goog.asserts.assert( | 813 goog.asserts.assert( |
783 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 814 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
784 return this.decoder_.readInt32(); | 815 return this.decoder_.readInt32(); |
785 }; | 816 }; |
786 | 817 |
787 | 818 |
788 /** | 819 /** |
| 820 * Reads a signed 32-bit fixed-length integer fiield from the binary stream, or |
| 821 * throws an error if the next field in the stream is not of the correct wire |
| 822 * type. |
| 823 * |
| 824 * @return {string} The value of the signed 32-bit integer field as a decimal |
| 825 * string. |
| 826 */ |
| 827 jspb.BinaryReader.prototype.readSfixed32String = function() { |
| 828 goog.asserts.assert( |
| 829 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
| 830 return this.decoder_.readInt32().toString(); |
| 831 }; |
| 832 |
| 833 |
| 834 /** |
789 * Reads a signed 64-bit fixed-length integer fiield from the binary stream, or | 835 * Reads a signed 64-bit fixed-length integer fiield from the binary stream, or |
790 * throws an error if the next field in the stream is not of the correct wire | 836 * throws an error if the next field in the stream is not of the correct wire |
791 * type. | 837 * type. |
792 * | 838 * |
793 * @return {number} The value of the float field. | 839 * @return {number} The value of the sfixed64 field. |
794 */ | 840 */ |
795 jspb.BinaryReader.prototype.readSfixed64 = function() { | 841 jspb.BinaryReader.prototype.readSfixed64 = function() { |
796 goog.asserts.assert( | 842 goog.asserts.assert( |
797 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); | 843 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
798 return this.decoder_.readInt64(); | 844 return this.decoder_.readInt64(); |
799 }; | 845 }; |
800 | 846 |
801 | 847 |
802 /** | 848 /** |
| 849 * Reads a signed 64-bit fixed-length integer fiield from the binary stream, or |
| 850 * throws an error if the next field in the stream is not of the correct wire |
| 851 * type. |
| 852 * |
| 853 * Returns the value as a string. |
| 854 * |
| 855 * @return {string} The value of the sfixed64 field as a decimal string. |
| 856 */ |
| 857 jspb.BinaryReader.prototype.readSfixed64String = function() { |
| 858 goog.asserts.assert( |
| 859 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
| 860 return this.decoder_.readInt64String(); |
| 861 }; |
| 862 |
| 863 |
| 864 /** |
803 * Reads a 32-bit floating-point field from the binary stream, or throws an | 865 * Reads a 32-bit floating-point field from the binary stream, or throws an |
804 * error if the next field in the stream is not of the correct wire type. | 866 * error if the next field in the stream is not of the correct wire type. |
805 * | 867 * |
806 * @return {number} The value of the float field. | 868 * @return {number} The value of the float field. |
807 */ | 869 */ |
808 jspb.BinaryReader.prototype.readFloat = function() { | 870 jspb.BinaryReader.prototype.readFloat = function() { |
809 goog.asserts.assert( | 871 goog.asserts.assert( |
810 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 872 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
811 return this.decoder_.readFloat(); | 873 return this.decoder_.readFloat(); |
812 }; | 874 }; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 * Reads a packed sint64 field, which consists of a length header and a list of | 1083 * Reads a packed sint64 field, which consists of a length header and a list of |
1022 * zigzag varints. | 1084 * zigzag varints. |
1023 * @return {!Array.<number>} | 1085 * @return {!Array.<number>} |
1024 */ | 1086 */ |
1025 jspb.BinaryReader.prototype.readPackedSint64 = function() { | 1087 jspb.BinaryReader.prototype.readPackedSint64 = function() { |
1026 return this.readPackedField_(this.decoder_.readZigzagVarint64); | 1088 return this.readPackedField_(this.decoder_.readZigzagVarint64); |
1027 }; | 1089 }; |
1028 | 1090 |
1029 | 1091 |
1030 /** | 1092 /** |
| 1093 * Reads a packed sint64 field, which consists of a length header and a list of |
| 1094 * zigzag varints. Returns a list of strings. |
| 1095 * @return {!Array.<string>} |
| 1096 */ |
| 1097 jspb.BinaryReader.prototype.readPackedSint64String = function() { |
| 1098 return this.readPackedField_(this.decoder_.readZigzagVarint64String); |
| 1099 }; |
| 1100 |
| 1101 |
| 1102 /** |
1031 * Reads a packed fixed32 field, which consists of a length header and a list | 1103 * Reads a packed fixed32 field, which consists of a length header and a list |
1032 * of unsigned 32-bit ints. | 1104 * of unsigned 32-bit ints. |
1033 * @return {!Array.<number>} | 1105 * @return {!Array.<number>} |
1034 */ | 1106 */ |
1035 jspb.BinaryReader.prototype.readPackedFixed32 = function() { | 1107 jspb.BinaryReader.prototype.readPackedFixed32 = function() { |
1036 return this.readPackedField_(this.decoder_.readUint32); | 1108 return this.readPackedField_(this.decoder_.readUint32); |
1037 }; | 1109 }; |
1038 | 1110 |
1039 | 1111 |
1040 /** | 1112 /** |
1041 * Reads a packed fixed64 field, which consists of a length header and a list | 1113 * Reads a packed fixed64 field, which consists of a length header and a list |
1042 * of unsigned 64-bit ints. | 1114 * of unsigned 64-bit ints. |
1043 * @return {!Array.<number>} | 1115 * @return {!Array.<number>} |
1044 */ | 1116 */ |
1045 jspb.BinaryReader.prototype.readPackedFixed64 = function() { | 1117 jspb.BinaryReader.prototype.readPackedFixed64 = function() { |
1046 return this.readPackedField_(this.decoder_.readUint64); | 1118 return this.readPackedField_(this.decoder_.readUint64); |
1047 }; | 1119 }; |
1048 | 1120 |
1049 | 1121 |
1050 /** | 1122 /** |
| 1123 * Reads a packed fixed64 field, which consists of a length header and a list |
| 1124 * of unsigned 64-bit ints. Returns a list of strings. |
| 1125 * @return {!Array.<number>} |
| 1126 */ |
| 1127 jspb.BinaryReader.prototype.readPackedFixed64String = function() { |
| 1128 return this.readPackedField_(this.decoder_.readUint64String); |
| 1129 }; |
| 1130 |
| 1131 |
| 1132 /** |
1051 * Reads a packed sfixed32 field, which consists of a length header and a list | 1133 * Reads a packed sfixed32 field, which consists of a length header and a list |
1052 * of 32-bit ints. | 1134 * of 32-bit ints. |
1053 * @return {!Array.<number>} | 1135 * @return {!Array.<number>} |
1054 */ | 1136 */ |
1055 jspb.BinaryReader.prototype.readPackedSfixed32 = function() { | 1137 jspb.BinaryReader.prototype.readPackedSfixed32 = function() { |
1056 return this.readPackedField_(this.decoder_.readInt32); | 1138 return this.readPackedField_(this.decoder_.readInt32); |
1057 }; | 1139 }; |
1058 | 1140 |
1059 | 1141 |
1060 /** | 1142 /** |
1061 * Reads a packed sfixed64 field, which consists of a length header and a list | 1143 * Reads a packed sfixed64 field, which consists of a length header and a list |
1062 * of 64-bit ints. | 1144 * of 64-bit ints. |
1063 * @return {!Array.<number>} | 1145 * @return {!Array.<number>} |
1064 */ | 1146 */ |
1065 jspb.BinaryReader.prototype.readPackedSfixed64 = function() { | 1147 jspb.BinaryReader.prototype.readPackedSfixed64 = function() { |
1066 return this.readPackedField_(this.decoder_.readInt64); | 1148 return this.readPackedField_(this.decoder_.readInt64); |
1067 }; | 1149 }; |
1068 | 1150 |
1069 | 1151 |
1070 /** | 1152 /** |
| 1153 * Reads a packed sfixed64 field, which consists of a length header and a list |
| 1154 * of 64-bit ints. Returns a list of strings. |
| 1155 * @return {!Array.<string>} |
| 1156 */ |
| 1157 jspb.BinaryReader.prototype.readPackedSfixed64String = function() { |
| 1158 return this.readPackedField_(this.decoder_.readInt64String); |
| 1159 }; |
| 1160 |
| 1161 |
| 1162 /** |
1071 * Reads a packed float field, which consists of a length header and a list of | 1163 * Reads a packed float field, which consists of a length header and a list of |
1072 * floats. | 1164 * floats. |
1073 * @return {!Array.<number>} | 1165 * @return {!Array.<number>} |
1074 */ | 1166 */ |
1075 jspb.BinaryReader.prototype.readPackedFloat = function() { | 1167 jspb.BinaryReader.prototype.readPackedFloat = function() { |
1076 return this.readPackedField_(this.decoder_.readFloat); | 1168 return this.readPackedField_(this.decoder_.readFloat); |
1077 }; | 1169 }; |
1078 | 1170 |
1079 | 1171 |
1080 /** | 1172 /** |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1210 |
1119 | 1211 |
1120 /** | 1212 /** |
1121 * Reads a packed fixed hash64 field, which consists of a length header and a | 1213 * Reads a packed fixed hash64 field, which consists of a length header and a |
1122 * list of fixed hash64s. | 1214 * list of fixed hash64s. |
1123 * @return {!Array.<string>} | 1215 * @return {!Array.<string>} |
1124 */ | 1216 */ |
1125 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() { | 1217 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() { |
1126 return this.readPackedField_(this.decoder_.readFixedHash64); | 1218 return this.readPackedField_(this.decoder_.readFixedHash64); |
1127 }; | 1219 }; |
OLD | NEW |