Greetings all,
The aim of this class is to take a text file, and identify each unique word. I want to save the words into an array, and use each words' place in the array as an I.D. If the word is new, place it at the end of the array and print its id. If the word has been encountered before, I just want to print its I.D. The printed I.D's will make up a new text file, in QDimacs format.
So far I have a BufferedReader and BufferedWriter, Ive tried reading in a text document, and I'm getting a new text document in the required format, but its blank. Any idea's?

Here's the code,

package Converter;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.File;

import java.util.List;
import java.util.ArrayList;

public class WordReader {

public WordReader(File file) {
convert(file);
}

// take String args from FileSelector
private void convert(File file) {

// will store the words read from the file
List<String> wordList = new ArrayList<String>();
String fileName = file.toString() + ".qdimacs";

try {
// attempt to open the words file, and the new qdimacs file
BufferedReader br = new BufferedReader(new FileReader(file));
BufferedWriter wr = new BufferedWriter(new FileWriter(fileName));

String word = br.readLine();
String[] words = null;
int i;
int x;

// loop and read a line from the file as long as we dont
// get null

while (word != null) {
words = word.split(" ");
// compare the words to those in the arrayList

for (i = 1; i < wordList.size(); i++) {
String s = wordList.get(i);

for (x = 0; x < words.length; x++) {
String w = words[x].toString();

if ((s.equals(w)) == true) {
// if the word has been seen before, print the words place in the array
wr.write(i);
wr.newLine();
}
// If the word hasn't been seen before, place it on the end of the
// array and print its place.
else
wordList.add(word);
wr.write(wordList.size());
}
}
br.close();
wr.close();
}

} catch (IOException e) {
e.printStackTrace();
}

}
}