OutPutStream 출력 파일

1163 단어
package zmx.Io;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Set;

/**
 *  、 
1、 、File   
2、         OutputStream   FileOutputStream
3、 :write()+flush()
4、 : 
 * @author zmx
 *
 */
public class demo06 {
	public static void main(String[] args) {
		File dest=new File("F:"+File.separator+" "+File.separator+"10.txt");
		OutputStream os=null;
		// 
		try {
			os=new FileOutputStream(dest,true);
			//3、 
			String str="bjsxt is very good \r  
"; byte[] data=str.getBytes(); os.write(data, 0, data.length); os.flush();// } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println(" "); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println(" "); }finally { if(null!=os){ try { os.close(); } catch (IOException e) { // TODO Auto-generated catch block System.out.println(" "); } } } } }

좋은 웹페이지 즐겨찾기