com.threerings.getdown.data
Class Digest

java.lang.Object
  extended by com.threerings.getdown.data.Digest

public class Digest
extends Object

Manages the digest.txt file and the computing and processing of MD5 digests for an application.


Field Summary
static String DIGEST_FILE
          The name of our MD5 digest file.
 
Constructor Summary
Digest(File appdir)
          Creates a digest instance which will parse and validate the digest.txt in the supplied application directory.
 
Method Summary
static void createDigest(List<Resource> resources, File output)
          Creates a digest file at the specified location using the supplied list of resources.
static MessageDigest getMessageDigest()
          Obtains an appropriate message digest instance for use by the Getdown system.
 String getMetaDigest()
          Returns the digest for the digest file.
 boolean validateResource(Resource resource, ProgressObserver obs)
          Computes the MD5 hash of the specified resource and compares it with the value parsed from the digest file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGEST_FILE

public static final String DIGEST_FILE
The name of our MD5 digest file.

See Also:
Constant Field Values
Constructor Detail

Digest

public Digest(File appdir)
       throws IOException
Creates a digest instance which will parse and validate the digest.txt in the supplied application directory.

Throws:
IOException
Method Detail

getMetaDigest

public String getMetaDigest()
Returns the digest for the digest file.


validateResource

public boolean validateResource(Resource resource,
                                ProgressObserver obs)
Computes the MD5 hash of the specified resource and compares it with the value parsed from the digest file. Logs a message if the resource fails validation.

Returns:
true if the resource is valid, false if it failed the digest check or if an I/O error was encountered during the validation process.

createDigest

public static void createDigest(List<Resource> resources,
                                File output)
                         throws IOException
Creates a digest file at the specified location using the supplied list of resources.

Throws:
IOException

getMessageDigest

public static MessageDigest getMessageDigest()
Obtains an appropriate message digest instance for use by the Getdown system.



Copyright © 2013. All Rights Reserved.