FileDocCategorySizeDatePackage
FileSummer.javaAPI DocExample640Fri Feb 10 13:02:40 GMT 2006None

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.
    for (int b = in.read(); b != -1; b = in.read()) {
      cs.update(b);
    }
    return cs.getValue();
  
public static voidmain(java.lang.String[] args)

     FileInputStream fin = new FileInputStream(args[0]);      
     System.out.println(args[0] + ":\t" + getCRC32(fin));
     fin.close();