|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectcom.wjholden.md5test.Md5Test
public class Md5Test
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes'?>
<SecureDownload>
<file name='abc.txt'>
<chunk>26b6350aacc2c3105b7c5628080bae0b</chunk>
<chunk>ab070fbcc4aeb75e742a3d0e71ab03db</chunk>
</file>
</SecureDownload>
| Field Summary | |
|---|---|
private static java.lang.String |
USAGE
|
| Constructor Summary | |
|---|---|
Md5Test()
|
|
| Method Summary | |
|---|---|
private static void |
createXmlPackage(java.lang.String inputFile,
java.lang.String outputFile,
int chunksize,
boolean showOutput)
Build an XML file AND split inputFile into files where filename is the same as their MD5 hash. |
private static java.lang.String |
hashByteArray(byte[] array)
Calculate the MD5 sum of a byte array. Warning: this method has a very tricky bug. |
private static java.lang.String |
hashFile(java.lang.String filename,
boolean showOutput)
Calculate the MD5 hash of a file. |
private static java.lang.String |
hashHttp(java.lang.String uri,
boolean writeFile,
boolean showOutput)
Grabs a single file from the world wide web and calculates it's hash as it downloads. |
private static void |
hashXml(java.lang.String filename,
boolean showOutput)
Doesn't actually perform the hashes, this was just me developing a method to parse the XML. |
static void |
main(java.lang.String[] args)
|
private static void |
reassembleXmlPkg(java.lang.String xmlpkg,
boolean showOutput)
On the local filesystem, reassemble a file that was previously broken up by createXmlPackage, where xmlpkg is the filename of the XML file. |
private static void |
reassembleXmlPkgFromURI(java.lang.String uri,
boolean showOutput)
This is mostly a copy-and-paste job from my earlier hashHttp and reassembleXmlPkg methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String USAGE
| Constructor Detail |
|---|
public Md5Test()
| Method Detail |
|---|
private static void createXmlPackage(java.lang.String inputFile,
java.lang.String outputFile,
int chunksize,
boolean showOutput)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
inputFile - outputFile - chunksize - showOutput -
java.io.IOException
java.security.NoSuchAlgorithmException
private static java.lang.String hashByteArray(byte[] array)
throws java.security.NoSuchAlgorithmException
array -
java.security.NoSuchAlgorithmException
private static java.lang.String hashFile(java.lang.String filename,
boolean showOutput)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
filename - showOutput -
java.security.NoSuchAlgorithmException
java.io.IOException
private static java.lang.String hashHttp(java.lang.String uri,
boolean writeFile,
boolean showOutput)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
uri - writeFile - If true, actually save the file to the current working directory, otherwise discard data.showOutput -
java.security.NoSuchAlgorithmException
java.io.IOException
private static void hashXml(java.lang.String filename,
boolean showOutput)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
filename - showOutput -
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOExceptionpublic static void main(java.lang.String[] args)
private static void reassembleXmlPkg(java.lang.String xmlpkg,
boolean showOutput)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException,
java.security.NoSuchAlgorithmException
xmlpkg - showOutput -
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
java.security.NoSuchAlgorithmException
private static void reassembleXmlPkgFromURI(java.lang.String uri,
boolean showOutput)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException,
java.security.NoSuchAlgorithmException
uri - showOutput -
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
java.security.NoSuchAlgorithmException
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||