java

package stream;

import java.io.*;

public class InputStreamReaderString {

    public static void main(String[] args)  {

        File f = new File("src/stream","hello.txt");
        
        try(FileInputStream fis = new FileInputStream(f)){
            
            byte[] all = new byte[(int)f.length()];
            
            fis.read(all);
            
            String str = new String(all);
            
            System.out.println(str);
            
        }catch(IOException e) {
            e.printStackTrace();
        }
        
    }

}
原文地址:https://www.cnblogs.com/500m/p/13854875.html