public static void writeUTF8(
      OutputStream outputStream,
      HiveDecimal hiveDecimal, int scale,
      byte[] scratchBuffer)
    throws IOException {
    if (hiveDecimal == null) {
      outputStream.write(nullBytes);
    } else {
      int index = hiveDecimal.toFormatBytes(scale, scratchBuffer);
      outputStream.write(scratchBuffer, index, scratchBuffer.length - index);
    }
  }
Writes HiveDecimal object to output stream as string
@param outputStream
@param hiveDecimal
@throws IOException
serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java