public void createIndexTREC(BufferedReader in) {
    String docid, line = null;
    int bytes = 0;

    try {

      while ((line = in.readLine()) != null) {
        bytes += line.length();

        if (line.startsWith("<DOC>")) {

          boolean inHTML = false;
          words = new ArrayList<String>();
          content = new StringBuffer();
          docid = null;

          while ((line = in.readLine()) != null) {
            bytes += line.length() + 1;
            if (line.startsWith("<DOCNO>")) {
              docid = line.substring(7, line.indexOf("</DOCNO>")).trim()
                  .toUpperCase();
              continue;
            } else if (line.startsWith("</DOC>")) {
              break;
            } else if (line.startsWith("</DOCHDR>")) {
              inHTML = true;
              continue;
            } else if (!inHTML) {
              continue;
            }
            content.append(line);
            content.append("\n");
          }

          // Use this to remove HTML markup with the default Java HTMLEditorkit
          // (use a better HTML parser if available!)
          // new ParserDelegator().parse(new StringReader(content.toString()),
          // new Callback(), true);

          // Use this to tokenize the entire content (incl. tags)
          StringTokenizer st = new StringTokenizer(content.toString(), delims);
          while (st.hasMoreTokens())
            words.add(st.nextToken().toLowerCase());

          // Extract Spot-Signatures
          tokenize(words, docid);

          SpotSigsIndexer.incrRead();
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    SpotSigsIndexer.incrBytes(bytes);
  }