1 57 58 import java.io.*; 59 60 import org.apache.oro.text.perl.*; 61 62 63 70 public final class jdfix { 71 72 101 public static final void main(String args[]) { 102 String line; 103 BufferedReader input = null; 104 PrintWriter output = null; 105 Perl5Util perl; 106 107 if(args.length < 2) { 108 System.err.println("Usage: jdfix input output"); 109 System.exit(1); 110 } 111 112 try { 113 input = 114 new BufferedReader(new FileReader(args[0])); 115 } catch(IOException e) { 116 System.err.println("Error opening input file: " + args[0]); 117 e.printStackTrace(); 118 System.exit(1); 119 } 120 121 try { 122 output = 123 new PrintWriter(new FileWriter(args[1])); 124 } catch(IOException e) { 125 System.err.println("Error opening output file: " + args[1]); 126 e.printStackTrace(); 127 System.exit(1); 128 } 129 130 perl = new Perl5Util(); 131 132 try { 133 while((line = input.readLine()) != null) { 134 line = perl.substitute("s/<body>/<body bgcolor=\"#ffffff\">/", line); 135 output.println(line); 136 } 137 } catch(IOException e) { 138 System.err.println("Error reading from input: " + args[1]); 139 e.printStackTrace(); 140 System.exit(1); 141 } finally { 142 try { 143 input.close(); 144 output.close(); 145 } catch(IOException e) { 146 System.err.println("Error closing files."); 147 e.printStackTrace(); 148 System.exit(1); 149 } 150 } 151 } 152 153 } 154 | Popular Tags |