BufferedReader|输入输出流BufferedReader PrintWriter demo
//查找建表语句sql导出package huawei; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class TextInput {public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new FileReader("D:\\masaa.sql")); PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("D:\\resultFile_a.txt"))); try {String ss = ""; boolean temp = false; while ((ss = br.readLine()) != null) {ss = ss.toUpperCase(); if (ss.indexOf("CREATE TABLE") != -1) {temp = true; }if (temp) {if (ss.trim().indexOf(")") == 0) {temp = false; pw.println("); "); System.out.println("); "); } else {pw.println(ss); System.out.println(ss); }}}pw.flush(); } catch (Exception e) {e.printStackTrace(); } finally {if (br != null) {br.close(); }if (pw != null) {pw.close(); }}}}
推荐阅读
- Node.js中readline模块实现终端输入
- 《深度倾听》第5天──「RIA学习力」便签输出第16期
- 大语文4
- 《思考,快与慢》第10天──「RIA学习力」便签输出第8期|《思考,快与慢》第10天──「RIA学习力」便签输出第8期 央央
- 选择篇(021)-下面代码的输出是什么?
- 选择篇(022)-下面代码的输出是什么?
- 用输出倒逼输入,加油!
- 剑指offer——最小的K个数
- 童频输出
- iOS输入框字体大小自适应时placehodler字体也被调整了大小