日期:2014-05-17 浏览次数:20795 次
/*写了个简单的线程处理*/
public static void output(final InputStream in, final ServletOutputStream out){
new Thread(){
public void run(){
byte[] buf = new byte[1024];
int n=0;
try{
while((n=in.read(buf))!=-1){
out.write(buf, 0, n);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}.start();
}