@@ -1142,6 +1142,20 @@ public void writeNull() throws IOException {
1142
1142
_writeByte (BYTE_NULL );
1143
1143
}
1144
1144
1145
+ /**
1146
+ * Method for outputting given value as an unsigned integer.
1147
+ * Can be called in any context where a value is expected
1148
+ * (Array value, Object field value, root-level value).
1149
+ *
1150
+ * @param i Number value to write
1151
+ * @throws IOException if there is either an underlying I/O problem or encoding
1152
+ * issue at format layer
1153
+ */
1154
+ public void writeNumberUnsigned (int i ) throws IOException {
1155
+ _verifyValueWrite ("write number unsigned" );
1156
+ _writeIntMinimal (PREFIX_TYPE_INT_POS , i );
1157
+ }
1158
+
1145
1159
@ Override
1146
1160
public void writeNumber (int i ) throws IOException {
1147
1161
_verifyValueWrite ("write number" );
@@ -1183,6 +1197,33 @@ public void writeNumber(int i) throws IOException {
1183
1197
_outputBuffer [_outputTail ++] = b0 ;
1184
1198
}
1185
1199
1200
+ /**
1201
+ * Method for outputting given value as an unsigned integer.
1202
+ * Can be called in any context where a value is expected
1203
+ * (Array value, Object field value, root-level value).
1204
+ *
1205
+ * @param l Number value to write
1206
+ * @throws IOException if there is either an underlying I/O problem or encoding
1207
+ * issue at format layer
1208
+ */
1209
+ public void writeNumberUnsigned (long l ) throws IOException {
1210
+ if (_cfgMinimalInts && l >= 0 && l < 0x100000000L ) {
1211
+ writeNumberUnsigned ((int ) l );
1212
+ return ;
1213
+ }
1214
+ _verifyValueWrite ("write number unsigned" );
1215
+ _ensureRoomForOutput (9 );
1216
+ _outputBuffer [_outputTail ++] = (byte ) (PREFIX_TYPE_INT_POS + SUFFIX_UINT64_ELEMENTS );
1217
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 56 );
1218
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 48 );
1219
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 40 );
1220
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 32 );
1221
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 24 );
1222
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 16 );
1223
+ _outputBuffer [_outputTail ++] = (byte ) (l >> 8 );
1224
+ _outputBuffer [_outputTail ++] = (byte ) l ;
1225
+ }
1226
+
1186
1227
@ Override
1187
1228
public void writeNumber (long l ) throws IOException {
1188
1229
_verifyValueWrite ("write number" );
0 commit comments