标签:
String info[] = {"MLDN","MLDNJAVA","www.mldn.cn","www.mldnjava.cn","李兴华","lixinghua"} ;//字符集
File file = new File("out.txt") ;
FileOutputStream output = null ;
new FileOutputStream(file) ;
FileChannel fout = output.getChannel() ; // 得到输出的通道
ByteBuffer buf = ByteBuffer.allocate(1024) ;
for(int i=0;i<info.length;i++){
buf.put(info[i].getBytes()) ; // 字符串变为字节数组放进缓冲区之中
}
buf.flip() ;
fout.write(buf) ; // 输出缓冲区的内容
fout.close() ;
output.close() ;
标签:
原文地址:http://www.cnblogs.com/chenxuezhouLearnProgram/p/5719239.html