[size=large]代码例子[/size]
package com.test;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class InputStreamTest
{
public static void main(String[] args) throws IOException
{
InputStream in = new FileInputStream("c:/hello.txt");
byte[] buffer = new byte[200];
int length = 0;
while (-1 != (length = in.read(buffer, 0, 200)))
{
String str = new String(buffer,0,length);
System.out.println(str);
}
in.close();
}
}