Okay, below is my code, it is supposed to (btw this is for a class project in case you are wondering why any one would want to do this) okay, it is supposed to take in a file and replace all the letters of one type with another.

So far as I can tell it reads in the file well, and then it parses it
into a vector with the appropriate text strings

But when I try to write out to a file, then it simply makes the file name but writes nothing to it.


If any one can help I would appreciate it.

public static void fileReplaceCopy(String readFrom, String writeTo,
char toReplace, char replaceWith){

try{
Vector v = new Vector();
FileReader myFile;
BufferedReader inputFile = null;
String line;
PrintWriter out =
new PrintWriter(new BufferedWriter( new FileWriter(writeTo)));


myFile = new FileReader(readFrom);
inputFile = new BufferedReader(myFile);

while( (line = inputFile.readLine()) != null){
v.addElement(line.replace(toReplace,replaceWith));
}

int i = 0;
while (v.elementAt(i) != null){
System.out.println(v.elementAt(i));
out.println (v.elementAt(i));
i ++;
}

out.close();

myFile.close();
}

catch (Exception e){}