Hi, I am writing a program that uses BufferedReader to Read through a postscript file and number the lines. So that I can write a postscript instruction at specific line numbers. However, I am encountering an error when I try to use BufferedWriter. I have tried closing the BufferedReader to no avail. Can anyone share insight of code that will help with this. Also can anyone recommend a way to search through a directory for files using a wildcard e.g "/e3/MAILING/1028.*". any insight or help would be appreciated.
In this code snippet I take a source file and while I read it with a LineNumberReader, when I process a particular line, I do something special with the text (in this case I reverse it). While I read the file, I copy it to a temporary file. At the end I replace the original file with the new temporary file.
Another approach is to use a memory stream to store temporary information, before writing back to file.
Regars, Edwin Dalorzo.
Joined: Dec 31, 2004
As for the listing files in a directory you can use the java.io.FileFilter or the java.io.FilenameFilter.