字节流之Input

    xiaoxiao2026-04-17  0

    package cn.mldn.demo; import java.io.File; import java.io.FileInputStream; import java.io.InputStream;; public class TestDemo { public static void main(String[] args) throws Exception{ File file=new File(“e:”+File.separator+”hello,world”+File.separator+”my.txt”); if(file.exists()){ InputStream inp=new FileInputStream(file); byte Byte[]= new byte[1024]; int temp=0; int foot=0; while((temp=inp.read())!=-1){ Byte[foot++]=(byte)temp; } System.out.println(“{“+”\n”+new String(Byte,0,foot)+”}”); } } }

    转载请注明原文地址: https://ju.6miu.com/read-1308926.html
    最新回复(0)