File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Java BufferedReader and BufferedWriter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Java BufferedReader and BufferedWriter" Watch "Java BufferedReader and BufferedWriter" New topic
Author

Java BufferedReader and BufferedWriter

harrell collins
Greenhorn

Joined: Mar 08, 2006
Posts: 22
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.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
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.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
As for the listing files in a directory you can use the java.io.FileFilter or the java.io.FilenameFilter.

Look at this code snippet.



Regards,
Edwin Dalorzo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java BufferedReader and BufferedWriter
 
Similar Threads
printing in j2me
xsl-fo to Postscript file
Comparing two huge files
Sockets
Pdf To Postscript