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 /** | |
761 * Reads an unsigned 32-bit fixed-length integer fiield from the binary stream, | 747 * Reads an unsigned 32-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 | 748 * or throws an error if the next field in the stream is not of the correct |
763 * wire type. | 749 * wire type. |
764 * | 750 * |
765 * @return {number} The value of the double field. | 751 * @return {number} The value of the double field. |
766 */ | 752 */ |
767 jspb.BinaryReader.prototype.readFixed32 = function() { | 753 jspb.BinaryReader.prototype.readFixed32 = function() { |
768 goog.asserts.assert( | 754 goog.asserts.assert( |
769 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 755 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
770 return this.decoder_.readUint32(); | 756 return this.decoder_.readUint32(); |
771 }; | 757 }; |
772 | 758 |
773 | 759 |
774 /** | 760 /** |
775 * Reads an unsigned 64-bit fixed-length integer fiield from the binary stream, | 761 * Reads an unsigned 64-bit fixed-length integer fiield from the binary stream, |
776 * 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 |
777 * wire type. | 763 * wire type. |
778 * | 764 * |
779 * @return {number} The value of the float field. | 765 * @return {number} The value of the float field. |
780 */ | 766 */ |
781 jspb.BinaryReader.prototype.readFixed64 = function() { | 767 jspb.BinaryReader.prototype.readFixed64 = function() { |
782 goog.asserts.assert( | 768 goog.asserts.assert( |
783 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); | 769 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
784 return this.decoder_.readUint64(); | 770 return this.decoder_.readUint64(); |
785 }; | 771 }; |
786 | 772 |
787 | 773 |
788 /** | 774 /** |
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 /** | |
806 * Reads a signed 32-bit fixed-length integer fiield from the binary stream, or | 775 * Reads a signed 32-bit fixed-length integer fiield from the binary stream, or |
807 * throws an error if the next field in the stream is not of the correct wire | 776 * throws an error if the next field in the stream is not of the correct wire |
808 * type. | 777 * type. |
809 * | 778 * |
810 * @return {number} The value of the signed 32-bit integer field. | 779 * @return {number} The value of the double field. |
811 */ | 780 */ |
812 jspb.BinaryReader.prototype.readSfixed32 = function() { | 781 jspb.BinaryReader.prototype.readSfixed32 = function() { |
813 goog.asserts.assert( | 782 goog.asserts.assert( |
814 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 783 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
815 return this.decoder_.readInt32(); | 784 return this.decoder_.readInt32(); |
816 }; | 785 }; |
817 | 786 |
818 | 787 |
819 /** | 788 /** |
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 /** | |
835 * Reads a signed 64-bit fixed-length integer fiield from the binary stream, or | 789 * Reads a signed 64-bit fixed-length integer fiield from the binary stream, or |
836 * throws an error if the next field in the stream is not of the correct wire | 790 * throws an error if the next field in the stream is not of the correct wire |
837 * type. | 791 * type. |
838 * | 792 * |
839 * @return {number} The value of the sfixed64 field. | 793 * @return {number} The value of the float field. |
840 */ | 794 */ |
841 jspb.BinaryReader.prototype.readSfixed64 = function() { | 795 jspb.BinaryReader.prototype.readSfixed64 = function() { |
842 goog.asserts.assert( | 796 goog.asserts.assert( |
843 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); | 797 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); |
844 return this.decoder_.readInt64(); | 798 return this.decoder_.readInt64(); |
845 }; | 799 }; |
846 | 800 |
847 | 801 |
848 /** | 802 /** |
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 /** | |
865 * Reads a 32-bit floating-point field from the binary stream, or throws an | 803 * Reads a 32-bit floating-point field from the binary stream, or throws an |
866 * error if the next field in the stream is not of the correct wire type. | 804 * error if the next field in the stream is not of the correct wire type. |
867 * | 805 * |
868 * @return {number} The value of the float field. | 806 * @return {number} The value of the float field. |
869 */ | 807 */ |
870 jspb.BinaryReader.prototype.readFloat = function() { | 808 jspb.BinaryReader.prototype.readFloat = function() { |
871 goog.asserts.assert( | 809 goog.asserts.assert( |
872 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); | 810 this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); |
873 return this.decoder_.readFloat(); | 811 return this.decoder_.readFloat(); |
874 }; | 812 }; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 * Reads a packed sint64 field, which consists of a length header and a list of | 1021 * Reads a packed sint64 field, which consists of a length header and a list of |
1084 * zigzag varints. | 1022 * zigzag varints. |
1085 * @return {!Array.<number>} | 1023 * @return {!Array.<number>} |
1086 */ | 1024 */ |
1087 jspb.BinaryReader.prototype.readPackedSint64 = function() { | 1025 jspb.BinaryReader.prototype.readPackedSint64 = function() { |
1088 return this.readPackedField_(this.decoder_.readZigzagVarint64); | 1026 return this.readPackedField_(this.decoder_.readZigzagVarint64); |
1089 }; | 1027 }; |
1090 | 1028 |
1091 | 1029 |
1092 /** | 1030 /** |
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 /** | |
1103 * Reads a packed fixed32 field, which consists of a length header and a list | 1031 * Reads a packed fixed32 field, which consists of a length header and a list |
1104 * of unsigned 32-bit ints. | 1032 * of unsigned 32-bit ints. |
1105 * @return {!Array.<number>} | 1033 * @return {!Array.<number>} |
1106 */ | 1034 */ |
1107 jspb.BinaryReader.prototype.readPackedFixed32 = function() { | 1035 jspb.BinaryReader.prototype.readPackedFixed32 = function() { |
1108 return this.readPackedField_(this.decoder_.readUint32); | 1036 return this.readPackedField_(this.decoder_.readUint32); |
1109 }; | 1037 }; |
1110 | 1038 |
1111 | 1039 |
1112 /** | 1040 /** |
1113 * Reads a packed fixed64 field, which consists of a length header and a list | 1041 * Reads a packed fixed64 field, which consists of a length header and a list |
1114 * of unsigned 64-bit ints. | 1042 * of unsigned 64-bit ints. |
1115 * @return {!Array.<number>} | 1043 * @return {!Array.<number>} |
1116 */ | 1044 */ |
1117 jspb.BinaryReader.prototype.readPackedFixed64 = function() { | 1045 jspb.BinaryReader.prototype.readPackedFixed64 = function() { |
1118 return this.readPackedField_(this.decoder_.readUint64); | 1046 return this.readPackedField_(this.decoder_.readUint64); |
1119 }; | 1047 }; |
1120 | 1048 |
1121 | 1049 |
1122 /** | 1050 /** |
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 /** | |
1133 * Reads a packed sfixed32 field, which consists of a length header and a list | 1051 * Reads a packed sfixed32 field, which consists of a length header and a list |
1134 * of 32-bit ints. | 1052 * of 32-bit ints. |
1135 * @return {!Array.<number>} | 1053 * @return {!Array.<number>} |
1136 */ | 1054 */ |
1137 jspb.BinaryReader.prototype.readPackedSfixed32 = function() { | 1055 jspb.BinaryReader.prototype.readPackedSfixed32 = function() { |
1138 return this.readPackedField_(this.decoder_.readInt32); | 1056 return this.readPackedField_(this.decoder_.readInt32); |
1139 }; | 1057 }; |
1140 | 1058 |
1141 | 1059 |
1142 /** | 1060 /** |
1143 * Reads a packed sfixed64 field, which consists of a length header and a list | 1061 * Reads a packed sfixed64 field, which consists of a length header and a list |
1144 * of 64-bit ints. | 1062 * of 64-bit ints. |
1145 * @return {!Array.<number>} | 1063 * @return {!Array.<number>} |
1146 */ | 1064 */ |
1147 jspb.BinaryReader.prototype.readPackedSfixed64 = function() { | 1065 jspb.BinaryReader.prototype.readPackedSfixed64 = function() { |
1148 return this.readPackedField_(this.decoder_.readInt64); | 1066 return this.readPackedField_(this.decoder_.readInt64); |
1149 }; | 1067 }; |
1150 | 1068 |
1151 | 1069 |
1152 /** | 1070 /** |
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 /** | |
1163 * Reads a packed float field, which consists of a length header and a list of | 1071 * Reads a packed float field, which consists of a length header and a list of |
1164 * floats. | 1072 * floats. |
1165 * @return {!Array.<number>} | 1073 * @return {!Array.<number>} |
1166 */ | 1074 */ |
1167 jspb.BinaryReader.prototype.readPackedFloat = function() { | 1075 jspb.BinaryReader.prototype.readPackedFloat = function() { |
1168 return this.readPackedField_(this.decoder_.readFloat); | 1076 return this.readPackedField_(this.decoder_.readFloat); |
1169 }; | 1077 }; |
1170 | 1078 |
1171 | 1079 |
1172 /** | 1080 /** |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 | 1118 |
1211 | 1119 |
1212 /** | 1120 /** |
1213 * Reads a packed fixed hash64 field, which consists of a length header and a | 1121 * Reads a packed fixed hash64 field, which consists of a length header and a |
1214 * list of fixed hash64s. | 1122 * list of fixed hash64s. |
1215 * @return {!Array.<string>} | 1123 * @return {!Array.<string>} |
1216 */ | 1124 */ |
1217 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() { | 1125 jspb.BinaryReader.prototype.readPackedFixedHash64 = function() { |
1218 return this.readPackedField_(this.decoder_.readFixedHash64); | 1126 return this.readPackedField_(this.decoder_.readFixedHash64); |
1219 }; | 1127 }; |
OLD | NEW |