JavaOOP字节流

    xiaoxiao2021-04-18  113

    package cn.hello.io; /** * 字节流 读取 */ import java.io.FileInputStream; import java.io.FileNotFoundException; public class Test2 { public static void main(String[] args) throws Exception { FileInputStream fis=new FileInputStream("e:/s2226.txt"); byte[] bytes=new byte[1024]; int data ; while ((data = fis.read(bytes))!=-1) { String str=new String(bytes,0,data); System.out.println(str); //data = fis.read(bytes); } fis.close(); } }
    转载请注明原文地址: https://ju.6miu.com/read-675623.html

    最新回复(0)