- package cn.lxl.input;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- public class InputTest1 {
- public static void main(String[] args) throws IOException {
- File file = new File("d:/test.txt");
- InputStream is = new FileInputStream(file);
- byte[] buffer = new byte[200];
- int length = 0;
- while (-1 != (length = (is.read(buffer, 0, 200)))) {
- String str = new String(buffer, 0, length);
- System.out.println(str);
- }
- is.close();
- }
- }
转载于:https://blog.51cto.com/532770034/641246