发新话题
打印

java.io.File写入写出的一个简单实例

java.io.File写入写出的一个简单实例

import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class TestIO { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub byte[] b = new byte[17*1024]; // ** txt // File f = new File("d:\\test.txt"); // File outF = new File("d:\\testOut.txt"); // ** jpg File f = new File("d:\\毫无保管.jpg"); File outF = new File("d:\\毫无保管Output.jpg"); try { FileInputStream fis = new FileInputStream(f); FileOutputStream fops = new FileOutputStream(outF); fis.read(b); fops.write(b); // ** for see // String s = new String(b); // System.out.println(s); fis.close(); fops.close(); } catch(FileNotFoundException fnfe) { System.out.println("FileNotFoundException fnfe"); fnfe.printStackTrace(); } catch(IOException ie) { System.out.elelen胶原蛋白口服液println("IOException ie"); ie.printStackTrace(); } } }
jiyizhen-buy.com颈椎保健枕太空记忆枕 igerl.com歌瑞尔内衣

TOP

发新话题