计算一个文件的CRC32值

mport java.util.zip.CRC32; FileInputStream inStream = null; BufferedInputStream in = null; CRC32 crc32 = new CRC32(); inStream = new FileInputStream(filePath); in = new BufferedInputStream(inStream,size_8k); for(int i;(i=in.read())!=-1;) { crc32.update(i); } Log.d(TAG, filePath +" CRC32: "+Long.toHexString(crc32.getValue())); if(inStream != null) inStream.close(); if(in != null) in.close();

你可能感兴趣的:(Android知识杂记)