FileDocCategorySizeDatePackage
InstanceCallbackDigest.javaAPI DocExample842Sat Sep 09 19:52:50 BST 2000None

InstanceCallbackDigest

public class InstanceCallbackDigest extends Object implements Runnable

Fields Summary
private File
input
private InstanceCallbackDigestUserInterface
callback
Constructors Summary
public InstanceCallbackDigest(File input, InstanceCallbackDigestUserInterface callback)

   this.input = input;
   this.callback = callback;
  
Methods Summary
public voidrun()

    try {
      FileInputStream in = new FileInputStream(input);
      MessageDigest sha = MessageDigest.getInstance("SHA");
      DigestInputStream din = new DigestInputStream(in, sha);
      int b;
      while ((b = din.read()) != -1) ;
      din.close();
      byte[] digest = sha.digest();
      callback.receiveDigest(digest);
    }
    catch (IOException e) {
      System.err.println(e);
    }
    catch (NoSuchAlgorithmException e) {
      System.err.println(e);
    }