public static void toHalfWidthFile(String infile, String outfile) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream(infile), "utf8"));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
				outfile), "utf8"));

		String line = null;
		while ((line = in.readLine()) != null) {
			line = line.trim();	
			if(line.length()==0)
				continue;
			line = toHalfWidth(line);
			out.write(line);
			out.newLine();
		}
		in.close();
		out.close();

	}
public static void toHalfWidthFile ( String infile , String outfile ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( new FileInputStream ( infile ) , "utf8" ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( outfile ) , "utf8" ) ) ; String line = null ; while ( ( line = in . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . length ( ) == 0 ) continue ; line = toHalfWidth ( line ) ; out . write ( line ) ; out . newLine ( ) ; } in . close ( ) ; out . close ( ) ; }
转换文件，将全角转为半角
@param infile
@param outfile
@throws IOException