Kxgx.com - 移动开发网

本站快讯:
搜索: 您的位置主页>参考源码>软件源码>>阅读源码:以Byte读取文件时测试是否达到末尾

以Byte读取文件时测试是否达到末尾

2006-09-21   来源:   作者:未知   【 】 评论:0条




// : c12:TestEOF.java
// Testing for end of file while reading a byte at a time.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.


import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class TestEOF {
  // Throw exceptions to console:
  public static void main(String[] argsthrows IOException {

    DataInputStream in = new DataInputStream(new BufferedInputStream(
        new FileInputStream("TestEOF.java")));
    while (in.available() != 0)
      System.out.print((charin.readByte());

  }
///:~


           

Tags:  
责任编辑:
  • 请文明参与讨论,禁止漫骂攻击。 用户名:新注册)密码:匿名:
    评论总数:0 [ 查看全部 ] 网友评论
    关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 帮助