私はそのBufferedReader
ように a を初期化します:
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に達する前に文字数を読み取るだけです。ここで何が起こっているか知っている人はいますか?