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