FileDocCategorySizeDatePackage
JoinDigestUserInterface.javaAPI DocExample934Sat Sep 09 19:52:58 BST 2000None

JoinDigestUserInterface

public class JoinDigestUserInterface extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


    ReturnDigest[] digestThreads = new ReturnDigest[args.length];
  
    for (int i = 0; i < args.length; i++) {

      // Calculate the digest
      File f = new File(args[i]);
      digestThreads[i] = new ReturnDigest(f);
      digestThreads[i].start();
    
    }
  
    for (int i = 0; i < args.length; i++) {

      try {      
        digestThreads[i].join();
        // Now print the result
        StringBuffer result = new StringBuffer(args[i]);
        result.append(": ");
        byte[] digest = digestThreads[i].getDigest();
        for (int j = 0; j < digest.length; j++) {
          result.append(digest[j] + " ");
        }  
        System.out.println(result);
      }
      catch (InterruptedException e) {
        System.err.println("Thread Interrupted before completion");
      } 
    
    }