文件的读和写
import java.io.BufferedReader;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;public class FileManager {public static String read(String fileName, String encoding) {StringBuffer fileContent = new StringBuffer();BufferedReader br = null;try {br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), encoding));String line = null;while ((line = br.readLine()) != null) {fileContent.append(line);fileContent.append(System.getProperty("line.separator"));}} catch (Exception e) {e.printStackTrace();} finally {if (br != null)try {br.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return fileContent.toString();}public static void write(String fileContent, String fileName,String encoding) {OutputStreamWriter osw = null;try {osw = new OutputStreamWriter(new FileOutputStream(fileName),encoding);osw.write(fileContent);osw.flush();} catch (Exception e) {e.printStackTrace();} finally {if (osw != null)try {osw.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}public static void main(String[] args) {String encoding = "UTF-8";String sFile = "E:/map.html";String tFile = "E:/map2.html";FileManager.write(FileManager.read(sFile, encoding), tFile, encoding);}}?