InputStream in = null;

       OutputStream out = null;

       try {

           in = new FileInputStream(path);

           int len = 0;

           byte buffer[] = new byte[1024];

           out = response.getOutputStream();

           while ((len = in.read(buffer)) > 0) {

              out.write(buffer, 0, len);

           }

       } finally {

           if (in != null) {

              try {

                  in.close();

              } catch (Exception e) {

                  e.printStackTrace();

              }

           }

           if (out != null) {

              try {

                  out.close();

              } catch (Exception e) {

                  e.printStackTrace();

              }

           }

       }

posted on 2011-05-06 10:43  情定诺坎普  阅读(203)  评论(0编辑  收藏  举报