import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class InputStreamTest1
{
public static void main(String[] args) throws Exception
{
InputStream is = new FileInputStream("c:/hello.txt");
byte[] buffer = new byte[200];
int length = 0; //实际读了多少长度
while(-1 != (length = is.read(buffer,0,200))) //字节输入流的read方法
{
String str = new String(buffer,0,length);
System.out.println(str);
}
is.close();
}
}
import java.io.FileNotFoundException;
import java.io.InputStream;
public class InputStreamTest1
{
public static void main(String[] args) throws Exception
{
InputStream is = new FileInputStream("c:/hello.txt");
byte[] buffer = new byte[200];
int length = 0; //实际读了多少长度
while(-1 != (length = is.read(buffer,0,200))) //字节输入流的read方法
{
String str = new String(buffer,0,length);
System.out.println(str);
}
is.close();
}
}