Example usage for org.apache.hadoop.fs MD5MD5CRC32FileChecksum getBytes

List of usage examples for org.apache.hadoop.fs MD5MD5CRC32FileChecksum getBytes

Introduction

In this page you can find the example usage for org.apache.hadoop.fs MD5MD5CRC32FileChecksum getBytes.

Prototype

@Override
    public byte[] getBytes() 

Source Link

Usage

From source file:com.bigstep.datalake.JsonUtil.java

License:Apache License

/** Convert a MD5MD5CRC32FileChecksum to a Json string. */
public static String toJsonString(final MD5MD5CRC32FileChecksum checksum) {
    if (checksum == null) {
        return null;
    }//from  w  w w.  j a v  a 2s  . c  o m

    final Map<String, Object> m = new TreeMap<String, Object>();
    m.put("algorithm", checksum.getAlgorithmName());
    m.put("length", checksum.getLength());
    m.put("bytes", StringUtils.byteToHexString(checksum.getBytes()));
    return toJsonString(FileChecksum.class, m);
}