import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import javax.swing.JFileChooser;


public class Main {

	public static void main(String ar[]){
		JFileChooser fileChooser =new JFileChooser();
		fileChooser.showOpenDialog(null);
		
		File fl = fileChooser.getSelectedFile();
		byte b[] =new byte[(int)fl.length()];
		try {
			FileInputStream fileinput =new FileInputStream(fl);
			fileinput.read(b);
			String string=new String(b);
			
			System.out.println(fl.getAbsolutePath());
			System.out.print(string);
			fileChooser.showSaveDialog(null);
			File fout =fileChooser.getSelectedFile();
			FileOutputStream fileout =new FileOutputStream(fout);
			fileout.write(b);
			fileout.close();
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}
}




java ---- 文件读取文件另存为_java