标签:
package com.hanqi.IO; import java.io.*; public class IoDemo { public static void main(String[] args) { File file=new File("d:/text.txt"); try { FileInputStream fis=new FileInputStream(file); byte[]d=new byte[1024]; fis.read(d); String str1=new String(d); System.out.println("读入的内容="+str1); fis.close(); File file1=new File("d:/iodemo.txt"); if(!file1.exists()) { file1.createNewFile(); } FileOutputStream fos=new FileOutputStream(file1); String str=str1; byte []b=str.getBytes(); fos.write(b); fos.close(); System.out.println("写入完成"); } catch(Exception e) { e.printStackTrace(); } } }
标签:
原文地址:http://www.cnblogs.com/jskbk/p/5548113.html