[Advanced-java] Processing text files

Wesley@lwsi.com Wesley at lwsi.com
Tue Jun 3 21:43:17 2003


This is a multipart message in MIME format.
---------------------- multipart/alternative attachment
I was wondering if anyone knows an easy way to do this.  I am needing to 
take a file that has end of line characters, carriage returns in it, and 
produce a text file that does not have these end of line characters.  The 
white space I do need though.  Here is some of the code I have been 
trying, but it does not do what I need

public class fileCramming {
 
    /** Creates a new instance of fileCramming */
    public fileCramming() {
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        File inputFile = new File("C:\\hex837F.txt");
        File outputFile = new File("C:\\hex837FJava.txt");
 
        FileReader in = new FileReader(inputFile);
        FileWriter out = new FileWriter(outputFile);
        int c;
 
        while((c=in.read()) != -1) {
            if(c != 10)
                out.write(c); 
        }
        in.close();
        out.close();
    }
 
}


Thank you,

Wesley Choate
LWSI Support Programmer
---------------------- multipart/alternative attachment
An HTML attachment was scrubbed...
URL: /lists/advanced-java/attachments/20030603/f9639b32/attachment.htm

---------------------- multipart/alternative attachment--