IO写 PrintWriter

    private static final String FILENAME = "c:\\temp\\out.txt";

     PrintWriter pw = null; try { pw = new PrintWriter(FILENAME); pw.println("hello this is ross speaking"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { pw.close(); }

 

PrintWriter 源码:

/*      */   public PrintWriter(String paramString)
/*      */     throws FileNotFoundException
/*      */   {
/*  157 */     this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(paramString))), false);
/*      */   }

 

posted @ 2017-04-03 11:08  kakaisgood  阅读(155)  评论(0编辑  收藏  举报