龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > JAVA开发 >

JAVA文件操作FileInputStream

时间:2009-12-23 15:42来源:未知 作者:admin 点击:
分享到:

  文件操作的小程序
  
  

  http://www.25gy.com/myworks/StreamControl[Java].rar

  这个是我做的文件操作的小程序,有需要者下。

  用流操作
  import java.io.*;
  class FileStreamTest
  {
  public static void main(String[] args)
  {
    String filename ;
    int ch = 0 ;
    filename = "gongtao.txt" ;
    try
    {
     FileInputStream fis = new FileInputStream(filename);
     while ((ch=fis.read())!=-1)
     {
      System.out.print((char)ch);
     }
     fis.close();
    }
    catch (IOException e)
    {
     System.out.println(e.toString());
    }
  }
  }


  
精彩图集

赞助商链接