public static String convertScanToString(Scan scan) throws IOException {
    ClientProtos.Scan proto = ProtobufUtil.toScan(scan);
    return Bytes.toString(Base64.getEncoder().encode(proto.toByteArray()));
  }
Writes the given scan into a Base64 encoded string.
@param scan The scan to write out.
@return The scan saved in a Base64 encoded string.
@throws IOException When writing the scan fails.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java