首页 > 学院 > 开发设计 > 正文

JAVA文件操作FileInputStream

2019-11-18 11:21:33
字体:
来源:转载
供稿:网友

文件操作的小程序

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());
  }
}
}



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表