1/**
2 * Copyright(C) 2003
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : June 1, 2003.
11 * @authorĀ : Salih Yurttas, Brian Autry.
12 */
13
14
15import java.io.*;
16
17public class JDBCScriptRunnerFileIO {
18
19 private String fileName;
20 private File inputFile;
21 private File outputFile;
22 private BufferedReader inputBR;
23
24 public JDBCScriptRunnerFileIO() {}
25
26 public String readFile(String s) {
27 inputFile = new File(s);
28 String line;
29 String all = "";
30
31 try {
32 inputBR = new BufferedReader(new FileReader(inputFile));
33 while((line=inputBR.readLine())!=null)
34 all = all + line + "\n";
35 inputBR.close();
36 }
37 catch(Exception e) {
38 e.printStackTrace();
39 }
40
41 return all;
42 }
43
44 public boolean writeFile(String fileName,
45 String results) {
46 try {
47 PrintWriter out = new PrintWriter
48 (new BufferedWriter(new FileWriter(fileName)));
49 out.write(results);
50 out.close();
51 }
52 catch(Exception e) {
53 return false;
54 }
55 return true;
56 }
57
58}