日期:2014-05-17 浏览次数:20719 次
/*写了个简单的线程处理*/ 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(); }
------解决方案--------------------
out.write一行后就out.flush()一下,这样在页面就会输出write的内容的