我这样初始化 a BufferedReader
:
Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
filename
任何给定的字符串在哪里。
当我通过这样的循环处理输出时:
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;
}
它只65536
在到达 EOF 之前读取字符数。有人知道这里发生了什么吗?