private ValueNode getByteValue(final byte[] buf) throws SerDeException {
    switch (this.binaryEncoding) {
    case RAWSTRING:
      final Text txt = new Text();
      txt.set(buf, 0, buf.length);
      return this.nodeFactory.textNode(txt.toString());
    case BASE64:
      return this.nodeFactory.binaryNode(buf);
    default:
      throw new SerDeException(
          "Error generating JSON binary type from record.");
    }
  }
Convert a byte array into a text representation.

@param o The byte array to convert to text
@return A JsonNode with the binary data encoded
@throws SerDeException The struct cannot be parsed
serde/src/java/org/apache/hadoop/hive/serde2/json/HiveJsonWriter.java