1 43 package net.jforum.view.install; 44 45 import java.io.BufferedReader ; 46 import java.io.FileReader ; 47 import java.io.IOException ; 48 import java.util.ArrayList ; 49 import java.util.List ; 50 51 55 public class ParseDBDumpFile 56 { 57 public static List parse(String filename) throws IOException 58 { 59 List statements = new ArrayList (); 60 61 BufferedReader reader = null; 62 63 try { 64 reader = new BufferedReader (new FileReader (filename)); 65 StringBuffer sb = new StringBuffer (512); 66 String line = null; 67 68 while ((line = reader.readLine()) != null) { 69 if (line.length() == 0) { 70 continue; 71 } 72 73 char charAt = line.charAt(0); 74 75 if (charAt == '-' || charAt == '#') { 76 continue; 77 } 78 79 if (line.indexOf(';') > -1) { 80 line = line.replace(';', ' '); 81 } 82 83 statements.add(line); 84 } 85 } 86 finally { 87 if (reader != null) { 88 try { reader.close(); } catch (Exception e) {} 89 } 90 } 91 92 return statements; 93 } 94 } 95 | Popular Tags |