62,620
社区成员
发帖
与我相关
我的任务
分享
import java.io.*;
public class TestInputStream1{
public static void main(String args[])throws IOException{
InputStream is = new FileInputStream(args[0]);//new一个File进去也不行
byte b[] = new byte[10000];
int len = 0;
while(true){
len = is.read(b);
if(len == -1){
break;
}
//System.out.println(len);
System.out.print(new String(b,0,len));
}
is.close();
}
}
public class TestInput {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
InputStream is = new FileInputStream(new File("D:/1.txt"));// new一个File进去也不行
byte b[] = new byte[1024];
int len = 0;
while ((len = is.read(b)) != -1) {
System.out.print(new String(b, 0, len));
}
is.close();
}
}