j_datainputstream.java

来自「一个十分好的java基础学习的课件」· Java 代码 · 共 44 行

JAVA
44
字号
// ////////////////////////////////////////////////////////
// 
// J_DataInputStream.java
// 

// ////////////////////////////////////////////////////////

import java.io.*; 

public class J_DataInputStream
{

    public static void main(String args[])
    {
        byte b;

        try
        {
            FileInputStream t= new FileInputStream("out.txt");
            DataInputStream f =new DataInputStream(t);
            while (true)
            {
                try
                {
                    b= f.readByte( );
                    b-=(byte)'0';
                    System.out.print(b);
                }
                catch(EOFException ex)
                {
                    System.out.println( );
                    break;
                } // End of try/catch structure.
            } // End of loop: while
            f.close( );
        } 
        catch(Exception e)
        {
            System.out.println(e);
        } // End of try/catch structure.
    } // End of method: main

} // End of class: J_DataInputStream

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?