FileDocCategorySizeDatePackage
ReturnDigest1.javaAPI DocExample766Sun Dec 12 10:51:28 GMT 2004None

ReturnDigest1

public class ReturnDigest1 extends Object implements Runnable

Fields Summary
private File
input
private byte[]
digest
Constructors Summary
public ReturnDigest1(File input)

   this.input = input;
  
Methods Summary
public byte[]getDigest()

    return digest;
  
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();
      digest = sha.digest();
    }
    catch (IOException e) {
      System.err.println(e);
    }
    catch (NoSuchAlgorithmException e) {
      System.err.println(e);
    }