documentation and prototyping

This commit is contained in:
Vincent Batts 2012-10-25 17:01:50 -04:00
parent c07d6ab172
commit 2779cfa63d
3 changed files with 46 additions and 3 deletions

View File

@ -27,6 +27,12 @@ import org.bouncycastle.asn1.*;
import org.bouncycastle.x509.extension.X509ExtensionUtil;
/*
* App
*
* This is just a simple class to handle command line interactions
*
*/
public class App {
public static byte[] getBytesFromFile(File file) throws IOException {
@ -65,11 +71,11 @@ public class App {
}
public static List<String> hydrateFromBytes(byte[] derblob) {
public static List<String> hydrateFromBytes(byte[] compressedBlob) {
Util util = new Util();
try {
return util.hydrateContentPackage(derblob);
return util.hydrateContentPackage(compressedBlob);
} catch (IOException ex) {
System.out.println(ex);
}

View File

@ -15,11 +15,31 @@
package com.redhat.trie;
import java.util.List;
/*
* PathTree
*
* The efficient means by which to check the content sets
*
* TODO - this is a prototype stub
*/
public class PathTree {
private HuffNode dict;
private PathNode tree;
public PathTree() {
}
public PathTree(byte[] payload) {
}
public boolean validate(String contentPath) {
return false;
}
public List<String> toList() {
return null;
}
}

View File

@ -43,6 +43,8 @@ import org.bouncycastle.x509.extension.X509ExtensionUtil;
/*
* Util
*
* All the misc dirty work
*
*/
public class Util {
private NodeContext pathNodeContext;
@ -506,8 +508,23 @@ public class Util {
/*
* FIXME - break this apart, so that the hydrated payload
* can be structure to more quickly search, and use less memory
*
* Rename it for tracking, and to be clear about what is happening
*/
public List<String> hydrateContentPackage(byte[] payload)
public List<String> hydrateContentPackage(byte[] compressedBlob)
throws IOException, UnsupportedEncodingException {
try {
return listFromCompressedBlob(compressedBlob);
} catch (Throwable t) {
throw t;
}
}
/*
* From the deflated payload, produce the content set lists
*
*/
public List<String> listFromCompressedBlob(byte[] payload)
throws IOException, UnsupportedEncodingException {
List<HuffNode> pathDictionary = new ArrayList<HuffNode>();
List<HuffNode> nodeDictionary = new ArrayList<HuffNode>();