All pastes #1524407 Raw Edit

H3R3T1C

public java v1 · immutable
#1524407 ·published 2009-08-10 21:48 UTC
rendered paste body
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package html_test;import java.awt.FileDialog;import java.awt.Frame;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;import java.util.logging.Level;import java.util.logging.Logger;/** * * @author H3R3T1C */public class Files {    public String getFile(Frame f, String title, String defDir, String fileType)    {    FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);    fd.setFile(fileType);    fd.setDirectory(defDir);    fd.setLocation(50, 50);    fd.show();    return fd.getDirectory()+fd.getFile();    }    public String loadFile(String path)    {        String Code="";        File file = new File(path);        try {            BufferedReader Data = new BufferedReader(new FileReader(file));            String Buffer="";            try {                while ((Buffer = Data.readLine()) != null) {                    Code+=Buffer+"\n";                }            } catch (IOException ex) {                System.out.println("Error: "+ex.toString());            }        } catch (FileNotFoundException ex) {            System.out.println("Error: "+ex.toString());        }        return Code;    }}