adding the byteProcess() function

This commit is contained in:
Vincent Batts 2012-10-05 08:50:23 -04:00
parent 6741e96c81
commit bcf6b61125

View file

@ -441,6 +441,20 @@ public class Util {
return nodesList.get(0); return nodesList.get(0);
} }
private byte[] byteProcess(List<String> entries)
throws IOException, UnsupportedEncodingException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DeflaterOutputStream dos = new DeflaterOutputStream(baos,
new Deflater(Deflater.BEST_COMPRESSION));
for (String segment : entries) {
dos.write(segment.getBytes("UTF-8"));
dos.write("\0".getBytes("UTF-8"));
}
dos.finish();
dos.close();
return baos.toByteArray();
}
private int findSmallest(int exclude, List<HuffNode> nodes) { private int findSmallest(int exclude, List<HuffNode> nodes) {
int smallest = -1; int smallest = -1;
for (int index = 0; index < nodes.size(); index++) { for (int index = 0; index < nodes.size(); index++) {