Here you can find the source of computeCRC(InputStream in)
public static long computeCRC(InputStream in)
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.Adler32; import java.util.zip.CheckedInputStream; public class Main { public static long computeCRC(InputStream in) { long unitCRC = 0; BufferedInputStream bufferedInputStream = null; try {//from w ww . ja va2 s . c o m bufferedInputStream = new BufferedInputStream(in); // Compute Adler-32 checksum CheckedInputStream cis = new CheckedInputStream(bufferedInputStream, new Adler32()); byte[] tempBuf = new byte[128]; while (cis.read(tempBuf) >= 0) { // do nothing } unitCRC = cis.getChecksum().getValue(); } catch (IOException e) { return -1; } finally { try { bufferedInputStream.close(); } catch (Exception e) { // ignore me even if i'm null } } return unitCRC; } }