@@ -287,6 +287,17 @@ public static void getChars(long i, int index, char[] buf) {
287
287
}
288
288
}
289
289
290
+ /**
291
+ * Writes a decimal number to a byte array buffer
292
+ *
293
+ * @param buf byte array buffer
294
+ * @param off buffer starting offset
295
+ * @param unscaledVal unscaled value (precision part of BigDecimal)
296
+ * @param scale number of digits after the decimal point, caller must ensure scale >= 0
297
+ * @return offset after writing
298
+ *
299
+ * Note: This method trusts that the caller has ensured scale >= 0
300
+ */
290
301
public static int writeDecimal (byte [] buf , int off , long unscaledVal , int scale ) {
291
302
if (unscaledVal < 0 ) {
292
303
putByte (buf , off ++, (byte ) '-' );
@@ -331,6 +342,17 @@ public static int writeDecimal(byte[] buf, int off, long unscaledVal, int scale)
331
342
return IOUtils .writeInt64 (buf , off , unscaledVal );
332
343
}
333
344
345
+ /**
346
+ * Writes a decimal number to a character array buffer
347
+ *
348
+ * @param buf character array buffer
349
+ * @param off buffer starting offset
350
+ * @param unscaledVal unscaled value (precision part of BigDecimal)
351
+ * @param scale number of digits after the decimal point, caller must ensure scale >= 0
352
+ * @return offset after writing
353
+ *
354
+ * Note: This method trusts that the caller has ensured scale >= 0
355
+ */
334
356
public static int writeDecimal (char [] buf , int off , long unscaledVal , int scale ) {
335
357
if (unscaledVal < 0 ) {
336
358
putChar (buf , off ++, '-' );
0 commit comments