FileDocCategorySizeDatePackage
ListCallbackDigestUserInterface.javaAPI DocExample1097Sun Dec 12 10:51:24 GMT 2004None

ListCallbackDigestUserInterface

public class ListCallbackDigestUserInterface extends Object implements DigestListener

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

    this.input = input;
  
Methods Summary
public voidcalculateDigest()

    ListCallbackDigest cb = new ListCallbackDigest(input);
    cb.addDigestListener(this);
    Thread t = new Thread(cb);
    t.start(); 
  
public voiddigestCalculated(byte[] digest)

  
    this.digest = digest;
    System.out.println(this);
  
public static voidmain(java.lang.String[] args)

  
    for (int i = 0; i < args.length; i++) {    
      // Calculate the digest
      File f = new File(args[i]);
      ListCallbackDigestUserInterface d
       = new ListCallbackDigestUserInterface(f);
      d.calculateDigest();
    } 
    
  
public java.lang.StringtoString()

    String result = input.getName() + ": ";
    if (digest != null) {
      for (int i = 0; i < digest.length; i++) {
        result += digest[i] + " ";
      }  
    }
    else {
      result += "digest not available";
    }
    return result;