Here you can find the source of getChecksumAlder32(File file)
public static long getChecksumAlder32(File file) throws IOException
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.Adler32; import java.util.zip.CheckedInputStream; public class Main { public static long getChecksumAlder32(File file) throws IOException { BufferedInputStream bufferedInputStream = null; try {//from w ww. j av a 2 s . c o m bufferedInputStream = new BufferedInputStream(new FileInputStream(file)); return getChecksumAlder32(bufferedInputStream); } catch (IOException e) { throw e; } finally { if (bufferedInputStream != null) { bufferedInputStream.close(); } } } public static long getChecksumAlder32(InputStream inputStream) throws IOException { if (inputStream == null) { return 0; } CheckedInputStream cis = null; try { // Compute Adler-32 checksum cis = new CheckedInputStream(inputStream, new Adler32()); byte[] tempBuf = new byte[128]; while (cis.read(tempBuf) >= 0) { // do nothing } return cis.getChecksum().getValue(); } catch (IOException e) { throw e; } finally { if (cis != null) { cis.close(); } } } }