- 浏览: 171393 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (193)
- Axis2 (10)
- Andriod (2)
- Java (22)
- Eclipse (2)
- 程序人生 (3)
- Windows (1)
- Sql Server 2005/2008 (7)
- 健身 (2)
- Log4j (1)
- Ant (1)
- Fatjar (2)
- 国际化 (1)
- Linux (3)
- JDBC (1)
- Oracle (2)
- 各种报错 (4)
- SWT (5)
- Tomcat (2)
- 车辆管理 (1)
- SVN (2)
- Spring (5)
- 域名服务器 (0)
- HaoWaYa (1)
- FTP (1)
- 集散中心 (1)
- 专业知识 (1)
- 面试准备 (19)
- 设计模式 (22)
- Junit (1)
- 软件下载 (3)
- 深入理解Java虚拟机 (3)
- 数据结构 (4)
- 雅思 托福 (0)
- UML (1)
- Maven (1)
- CV (1)
- ServiceMix (1)
- 电子书 (5)
- Struts1/2 (4)
- DOM W3C DHTML (3)
- Jawr (1)
- LoadRunner (1)
- Java反编译 (0)
- 英语学习 (0)
- 技术书籍 (1)
- Cygwin (0)
- ibatis (1)
- 数据库 (1)
- jQuery (0)
- s (2)
- 源代码项目 (5)
- JSRs (0)
- JCP (0)
- XML (2)
- Dojo (3)
- Effective Java (1)
- 一站到底 (3)
- JavaScript (6)
- DB2 (1)
- 刷机 (1)
- 字符 (1)
- Dynamic Web Project (1)
- 股市日记 (1)
- 代码片段 (0)
- CSS (1)
- PDF (0)
- 英语口语 (1)
- 乒乓球 (1)
- 体检 (0)
- 送花 (0)
- 面试准备-再战江湖 (5)
- ddq (0)
- sss (0)
- ssssss (0)
- 2020面试 (0)
最新评论
-
samsongbest:
Copperfield 写道你的目标很远大,佩服~惭愧,都忘了 ...
人生目标 -
Copperfield:
你的目标很远大,佩服~
人生目标
package util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class FileUtil {
private String endFix = ".java";
private String tempFile = "C:/tempFile.txt";
private String packageStr = "package";
private String importStr = "import";
public void changePackageAndImport(String path) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(path));
BufferedWriter bw = new BufferedWriter(new FileWriter(tempFile));
String str1 = "";
str1 = br.readLine();
while(str1!=null) {
// if(str1.startsWith(packageStr)) {
// str1 = str1.replace("package ", "package sam.");
// bw.write(str1);
// bw.newLine();
//
// if(path.contains("F:/Root/MyLife/workspace/Java官方类学习/src/java/util")) {
// bw.write("import java.util.Iterator;");
// bw.newLine();
// }
// } else if(str1.startsWith(importStr)) {
//
// str1 = str1.replace("import ", "import sam.");
// bw.write(str1);
// bw.newLine();
// } else
if(str1.contains("(java.io.ObjectOutputStream")) {
str1 = str1.replace("(java.io.ObjectOutputStream", "(sam.java.io.ObjectOutputStream");
bw.write(str1);
bw.newLine();
} else if(str1.contains("(java.io.ObjectInputStream")) {
str1 = str1.replace("(java.io.ObjectInputStream", "(sam.java.io.ObjectInputStream");
bw.write(str1);
bw.newLine();
} else if(str1.contains("throws java.io.IOException")) {
str1 = str1.replace("throws java.io.IOException", "throws sam.java.io.IOException");
bw.write(str1);
bw.newLine();
} else if(str1.contains("throw new java.io.StreamCorruptedException")) {
str1 = str1.replace("throw new java.io.StreamCorruptedException", "throw new sam.java.io.StreamCorruptedException");
bw.write(str1);
bw.newLine();
}
else {
bw.write(str1);
bw.newLine();
}
str1 = br.readLine();
}
bw.close();
br.close();
br = new BufferedReader(new FileReader(tempFile));
bw = new BufferedWriter(new FileWriter(path));
str1 = br.readLine();
while(str1!=null) {
bw.write(str1);
bw.newLine();
str1 = br.readLine();
}
bw.close();
br.close();
}
public void parsePathOrFile(String path) throws IOException {
System.out.println(path);
if(path.equals("C:/MyCitiLife/LearnPlan/JDK/java/awt/font")) {
int ss = 0;
}
File[] file = new File(path).listFiles();
if(file!=null && file.length!=0) {
for(int i = 0; i< file.length; i++) {
if(file[i].getName().endsWith(endFix)) {
changePackageAndImport(path.concat("/".concat(file[i].getName())));
} else {
parsePathOrFile(path.concat("/".concat(file[i].getName())));
}
}
}
}
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
FileUtil FileUtil = new FileUtil();
FileUtil.parsePathOrFile("F:/Root/MyLife/workspace/Java官方类学习/src");
}
}
发表评论
-
how tomcat works
2016-09-11 14:18 591how tomcat works, chinese and e ... -
【Core Java】 The Java I/O System
2014-09-09 16:32 407I/O 1. 最common的用法,从一个文件按行 ... -
用java编写简单Webserver,理解webserver的功能。
2014-01-08 11:06 917from http://www.cnblogs.com/wa ... -
课前练习
2013-12-27 17:47 0设计模式 课前李艾尼西 -
Java的规范制定
2012-08-14 15:49 7281. JCP: Java Community Process ... -
ResourceBundle
2012-08-03 13:23 7731. getBoundle //resources文件夹下的 ... -
Java Source Learning
2012-07-26 17:49 757Java Source Learning 2012-7-26 ... -
Java的位运算符&|^
2012-07-26 11:24 7511. & 与,同时满足 1&1 = 000 ... -
volatile
2012-07-26 11:02 621不稳定的,所以不同线程都要到共享内存中读取,不同线程看 ... -
transient
2012-07-13 23:57 973如果用transient声明一个实例变量,当对象存储时,它的 ... -
Java数据类型的长度
2012-07-13 23:55 712float4个字节 double8个字节 -
java 集合类图形解释
2012-04-30 20:30 806转自: http://messon619.iteye.com/ ... -
Java网络编程
2012-04-27 23:54 692http://www.cnblogs.com/springcs ... -
vvvvvvvvvvvvvvvvvvvvvvvvv
2012-04-24 13:33 5883Java Concurrency In Practice ... -
Java并发/多线程
2012-04-10 17:03 853Java多线程 实现线程的两种方法: a. 继承Threa ... -
深入研究java.lang.ThreadLocal类
2012-03-08 15:22 361深入研究java.lang.ThreadLocal类 ... -
Java中Split函数的用法技巧
2012-02-09 13:29 956<!-- [if gte mso 9]><x ... -
SimpleDataFormat 日期格式
2011-12-21 16:44 818Letter Date or Ti ... -
Thread stop不能用了
2011-12-19 17:39 3819http://docs.oracle.com/javase/6 ... -
java jar 命令行
2011-10-27 17:07 693java -jar xxx.jar <参数> ...
相关推荐
For the full history of release notes, see FinalIK Change Log.pdf in the package. Upgrade Guide - MAKE A BACKUP! Open a new scene, delete “Plugins/RootMotion” and reimport. Also reimport ...
Step1: Execute recompile.exe to generate specified version related folder and files (Recompile all package first, then Change Language to Chinese or othor one). step2: Execute @DelUnUsedFiles.bat to ...
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.table.*; public class MyCalendar extends JApplet { public static class CalendarTable extends JTable ...
For the full history of release notes, see FinalIK Change Log.pdf in the package. Upgrade Guide - MAKE A BACKUP! Open a new scene, delete “Plugins/RootMotion” and reimport. Also reimport ...
LibXL is a library for direct reading and writing Excel files. ... changelog.txt change log libxl.url link to home page license.txt end-user license agreement readme.txt this file
Please download and import them into your project. 1) Post Processing Stack 2) Cinemachine 3) Unity's Standard assets > Character 3D files are in FBX and texture files are in PSD in the package. ...
Product Page | Unity Asset Store | Changelog | Get Help Documentation for ZFBrowser v3.0.0. Uses CEF 74.1.19+gb62bacf+chromium-74.0.3729.157 / Chromium 74.0.3729.157. Copyright © 2015-2019 Zen ...
It reads all your PlayerPrefs and presents them in such a way you can create, change, delete and save them with one click. You no longer need to code to find out what the current state of your ...
Step1: Execute recompile.exe to generate specified version related folder and files (Recompile all package first, then Change Language to Chinese or othor one). step2: Execute @DelUnUsedFiles.bat to ...
You could find step-by-step guides on how to import UniWebView to your project, as well as some basic usage of this asset. You could also find a full script reference on the same site in this page: ...
Aerospike 客户端 GoAerospike Go ...package mainimport ( "fmt" aero "github.com/aerospike/aerospike-client-go/v7")// This is only for this example.// Please handle errors properly.func panicOnError(err
com / judrov / gochange用法#####导入package gochange import "github.com/judrov/gochange" #####设置配置参数 // sets API keyparams [ "API_KEY" ] = "my_api_key"// sets secret tokenparams [ "SECRET" ] = ...
PEP 371: The multiprocessing Package PEP 3101: Advanced String Formatting PEP 3105: print As a Function PEP 3110: Exception-Handling Changes PEP 3112: Byte Literals PEP 3116: New I/O Library PEP...
import { NgSelectModule } from '@ng-select/ng-select'; @NgModule({ imports: [NgSelectModule], // ... }) export class AppModule { } ``` 接着,在HTML模板中,使用`<ng-select>`标签来创建组件,并根据...
package myClass; /* * 淡入淡出窗口,淡出时,如果鼠标移进去了,则中止渐变。 * gradual change Frame */ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event....
Did you know that you can not only change what is on UltraEdit's toolbars, you can also change the icon used, as well as create your own custom toolbars and tools? File tabs Understand how file tabs ...
Allows to import data from Text and internal formats. Can sort data in various dataset's. Can filter data in various dataset's. When DBGridEh is connected to DataSet of TMemTable type it allows: ...