I intitialise a BufferedReader as such:
Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
where filename is any given string.
When I process the output through a loop as such:
int k;
while((k = reader.read()) != -1){
String entry;
if (dict.containsKey(k))
entry = dict.get(k);
else if (k == mapSize)
entry = w + w.charAt(0);
else
throw new IllegalArgumentException("Bad compressed k: " + k);
this.fos.write(entry);
result += entry;
// Add w+entry[0] to the dictionary.
dict.put(mapSize++, w + entry.charAt(0));
w = entry;
}
it only reads 65536 number of characters before hitting the EOF. Anyone know what's going on here?
Integer.MAX_VALUEis actually 2147483647.