All pastes #774041 Raw Edit

Stuff

public text v1 · immutable
·published 2007-11-14 22:44 UTC
rendered paste body
import java.io.*;

public class TextReader
{
    public void textReader(String fileName, String newFile)
    {
        try{
            File file = new File(fileName);
            BufferedReader br = new BufferedReader(new FileReader(file));
            String line = br.readLine();
            FileWriter fw = new FileWriter(newFile);
            while(line != null) {
                fw.write(line);
            }
            br.close();
            fw.close();
        }
        catch(FileNotFoundException e) {
            System.out.println("Filen kunne ikke findes");
        }
        catch(IOException e){
            System.out.println("Filen kunne ikke læses");
        }   
    }
}