0

我一直有一个奇怪的问题。我的循环突然停止循环,也不会中断。前几项读起来很好,然后突然停止了。

我有以下循环从文件中读取:

while ((tmpChar = in.read()) != -1) { //While we have not reached the end.
  System.out.println("looped");
  buffer[j] = tmpChar;
  // If this byte is a capital letter.
  if (buffer[j] > 64 && buffer[j] < 91) {
    // We make it lower-case.
    buffer[j] += 32;
  }
  if (buffer[j] != 39 && (buffer[j] < 96 || buffer[j] > 122) && (buffer[j] < 48 || buffer[j] > 56)) {
    // Otherwise, if byte is not an apostrophe, not a letter and
    // not a number.
    if (j > 0) {
      // Word is completed, let's "tokenize".
      words.insert(new String(buffer, 0, j));
      System.out.println(new String(buffer, 0, j));
    }
    j = 0;
  } else
    j++;
}
System.out.println("broke");
4

0 回答 0