Here you can find the source of crcFromStream(InputStream stream)
public static long crcFromStream(InputStream stream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; import java.util.zip.CRC32; public class Main { public static long crcFromStream(InputStream stream) throws IOException { CRC32 crc = new CRC32(); byte[] buffer = new byte[1024]; int length; while ((length = stream.read(buffer)) != -1) crc.update(buffer, 0, length); return crc.getValue(); }//w ww .j a va 2s. co m }