FileDocCategorySizeDatePackage
FileSummer.javaAPI DocExample786Sun Mar 28 19:07:18 BST 1999None

FileSummer

public class FileSummer extends Object

Fields Summary
Constructors Summary
Methods Summary
public static longgetCRC32(java.io.InputStream in)

  
    Checksum cs = new CRC32();
    
    // It would be more efficient to read chunks of data
    // at a time, but this is simpler and easier to understand
    int b;
    while ((b = in.read()) != -1) {
      cs.update(b);
    }
    return cs.getValue();
  
  
public static voidmain(java.lang.String[] args)


    for (int i = 0; i < args.length; i++) {
      try {
        FileInputStream fin = new FileInputStream(args[i]);      
        System.out.println(args[i] + ":\t" + getCRC32(fin));
        fin.close();
      }
      catch (IOException e) {
        System.err.println(e);     
      }
    }