CRC32: update(byte[] b, int off, int len) : CRC32 « java.util.zip « Java by API






CRC32: update(byte[] b, int off, int len)

 
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.util.Arrays;
import java.util.zip.CRC32;

public class Main {
  public static void main(String[] args) throws Exception{
    BufferedInputStream is = new BufferedInputStream(new FileInputStream("a.exe"));
    byte[] bytes = new byte[1024];
    int len = 0;

    while ((len = is.read(bytes)) >= 0) {
      new CRC32().update(bytes, 0, len);
    }
    is.close();
    System.out.println(Arrays.toString(bytes));

  }
}

   
  








Related examples in the same category

1.new CRC32()