import java.io.File;
import java.io.IOException;
import java.util.Collection;

import org.apache.commons.io.FileUtils;

public class XXXX {
public static void main(String[] args) throws IOException {
//GBK编码格式源码路径
String srcDirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//转为UTF-8编码格式源码路径
String utf8DirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//获取所有java文件
Collection javaGbkFileCol = FileUtils.listFiles(new File(srcDirPath), new String[]{"java"}, true);

    for (File javaGbkFile : javaGbkFileCol) { 
          //UTF8格式文件路径 
          String utf8FilePath = utf8DirPath+javaGbkFile.getAbsolutePath().substring(srcDirPath.length()); 
           //使用GBK读取数据,然后用UTF-8写入数据 
          FileUtils.writeLines(new File(utf8FilePath), "UTF-8", FileUtils.readLines(javaGbkFile, "GBK"));        
    }
}

}
import java.io.File;
import java.io.IOException;
import java.util.Collection;

import org.apache.commons.io.FileUtils;

public class XXXX {
public static void main(String[] args) throws IOException {
//GBK编码格式源码路径
String srcDirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//转为UTF-8编码格式源码路径
String utf8DirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//获取所有java文件
Collection javaGbkFileCol = FileUtils.listFiles(new File(srcDirPath), new String[]{"java"}, true);

    for (File javaGbkFile : javaGbkFileCol) { 
          //UTF8格式文件路径 
          String utf8FilePath = utf8DirPath+javaGbkFile.getAbsolutePath().substring(srcDirPath.length()); 
           //使用GBK读取数据,然后用UTF-8写入数据 
          FileUtils.writeLines(new File(utf8FilePath), "UTF-8", FileUtils.readLines(javaGbkFile, "GBK"));        
    }
}

}

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import org.apache.commons.io.FileUtils;

public class XXXX {
public static void main(String[] args) throws IOException {
//GBK编码格式源码路径
String srcDirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//转为UTF-8编码格式源码路径
String utf8DirPath = "D:\eclipse\eclipse\workspace\News\src\com\ischoolbar\programmer";
//获取所有java文件
Collection javaGbkFileCol = FileUtils.listFiles(new File(srcDirPath), new String[]{"java"}, true);

    for (File javaGbkFile : javaGbkFileCol) { 
          //UTF8格式文件路径 
          String utf8FilePath = utf8DirPath+javaGbkFile.getAbsolutePath().substring(srcDirPath.length()); 
           //使用GBK读取数据,然后用UTF-8写入数据 
          FileUtils.writeLines(new File(utf8FilePath), "UTF-8", FileUtils.readLines(javaGbkFile, "GBK"));        
    }
}

}

深圳网站建设www.sz886.com