package cn.imcore.cd;import java.io.*;
 
public class TestStream {
 
public static void main(String[] args)
{
File a = new File("tmp/file1.txt");
if(!a.exists())
{
try 
{
a.createNewFile();
}
catch (IOException e) 
{
e.printStackTrace();
}
InputStream is = null;
try 
{
is = new FileInputStream(a);
int tmp = is.read();
while(tmp != -1)
{
System.out.print((char)tmp);
tmp = is.read();
}

catch (FileNotFoundException e) 
{
e.printStackTrace();

catch (IOException e) 
{
e.printStackTrace();
}
finally
{
if(is != null)
{
try 
{
is.close();

catch (IOException e) 
{
e.printStackTrace();
}
}
}
}
 } 
}
代码看的难受!