

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.omg.CORBA.portable.OutputStream;
//=================================================
// File Name : code_demo
//------------------------------------------------------------------------------
// Author : Common
//主类
//Function : code_demo;
public class code_demo {
public static void main(String[] args) throws Exception {
// TODO 自动生成的方法存根
System.out.println("系统默认编码:"+System.getProperty("file.encoding")); //获取系统当前的编码
File file = new File("/home/common/software/coding/HelloWord/HelloWord/b.txt");//路径
FileOutputStream out = new FileOutputStream(file);
byte b[] = "中国".getBytes("ISO8859-1");
out.write(b);
out.close();
}
}
原文:http://www.cnblogs.com/tonglin0325/p/5281735.html