All Packages  This Package  Class Hierarchy  Class Search  Index

Class app.authkit.test.Digester
java.lang.Object
   |
   +----glguerin.util.Streamer
           |
           +----app.authkit.test.Digester

  Summary

public class  Digester
     extends glguerin.util.Streamer
{
          // Fields 2
     protected CRC32 checker;
     protected PrintStream prout;

          // Constructors 1
     public Digester(InputStream, PrintStream, String);

          // Methods 2
     protected InputStream getInput(InputStream, String);
     public void run();
}

A Digester uses a Thread to read an InputStream until EOF, optionally calculating a message-digest or checksum on it. This is useful when dealing with Processes that produce data on stdout, and we want to easily tell if different Processes produce the same data, without doing a byte-by-byte comparison.

Without a digest or checksum, the data simply flows through and is counted. With a digest or checksum, we can see whether the data was the same as another by visually comparing the displayed digest or checksum values.

A CRC (e.g. java.util.zip.CRC32) is smaller than a MessageDigest, so is more easily compared by visual inspection, but isn't as unique.

On EOF, the Thread terminates, optionally displaying its results to a PrintStream. This will be either a byte-count, or a byte-count and a checksum or digest.




  Fields

· checker

Summary  |  Top

   protected CRC32 checker


· prout

Summary  |  Top
   protected PrintStream prout


  Constructors

· Digester

Summary  |  Top

   public Digester(InputStream toConsume, 
                   PrintStream toExplain, 
                   String digestName) 

Transfer the InputStream, displaying data and results on a PrintStream, and running the data through a MessageDigest of the given algorithm-name. If the PrintStream is null, no results are emitted. If the digestName is null, no digest is produced.



  Methods

· getInput

Summary  |  Top
   protected InputStream getInput(InputStream stream, 
                                  String digestName) 

Returns the original stream, or a checked or digested InputStream fed from it.



· run

Summary  |  Top
   public void run() 

Pump bytes from the InputStream to the optional OutputStream (PrintStream). May also print a summary and digest in text form to PrintStream.

Overrides:
run in class Streamer
Implements:
run in interface Runnable


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7