Code example for CRC32

Methods: getValue, update

0
 
    @Implementation 
    public static Bitmap decodeByteArray(byte[] data, int offset, int length, BitmapFactory.Options opts) {
        String desc = new String(data);
        if (!Charset.forName("US-ASCII").newEncoder().canEncode(desc)) {
            Checksum checksumEngine = new CRC32();
            checksumEngine.update(data, 0, data.length);
 
            desc = "byte array, checksum: " + checksumEngine.getValue();
        } 
 
        if (offset != 0 || length != data.length) {
            desc += " bytes " + offset + ".." + length;
        } 
        return create(desc, opts);
    } 
     
    static Bitmap create(String name) {
        return create(name, null);
    }