adding the byteProcess() function
This commit is contained in:
parent
6741e96c81
commit
bcf6b61125
1 changed files with 14 additions and 0 deletions
|
@ -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++) {
|
||||||
|
|
Loading…
Reference in a new issue