
{filelink=13}
import java.io.*;
import java.util.zip.*;
public class ExempleCRC32 {
/*
 *  Lire un Fichier, calculer
 *  la somme de contrôle de ses
 *  données et afficher le résultat
 */
  public static void main(String[] args) throws IOException
  {
      String fichier="c:/test.txt";
     FileInputStream fin = new FileInputStream(fichier);
     System.out.println(fichier + ":t" + getCRC32(fin));
     fin.close();
  }
  public static long getCRC32(InputStream in) throws IOException {
    Checksum somme_controle = new CRC32();
    for (int b = in.read(); b != -1; b = in.read()) {
      somme_controle.update(b);
    }
    return somme_controle.getValue();
  }
}