@Override
  public final boolean incrementToken() throws IOException {
    clearAttributes();
    int length = 0;
    int start = bufferIndex;
    char[] buffer = termAtt.termBuffer();
    while (true) {

      if (bufferIndex >= dataLen) {
        offset += dataLen;
        dataLen = input.read(ioBuffer);
        if (dataLen == -1) {
          dataLen = 0;                            // so next offset += dataLen won't decrement offset
          if (length > 0)
            break;
          else
            return false;
        }
        bufferIndex = 0;
      }

      final char c = ioBuffer[bufferIndex++];

      if (isTokenChar(c)) {               // if it's a token char

        if (length == 0)                 // start of token
          start = offset + bufferIndex - 1;
        else if (length == buffer.length)
          buffer = termAtt.resizeTermBuffer(1+length);

        buffer[length++] = normalize(c); // buffer it, normalized

        if (length == MAX_WORD_LEN)      // buffer overflow!
          break;

      } else if (length > 0)             // at non-Letter w/ chars
        break;                           // return 'em
    }

    termAtt.setTermLength(length);
    offsetAtt.setOffset(correctOffset(start), correctOffset(start+length));
    return true;
  }