question: public static void streamContentToBrowser ( HttpServletResponse response , InputStream in , int length , String contentType , String fileName ) throws IOException { setResponseBrowserProxyNoCache ( response ) ; response . setContentLength ( length ) ; if ( contentType != null ) { response . setContentType ( contentType ) ; } if ( fileName != null ) { response . setHeader ( "Content-Disposition" , "attachment;filename=\"" + fileName + "\"" ) ; } OutputStream out = response . getOutputStream ( ) ; try { streamContent ( out , in , length ) ; } catch ( IOException e ) { out . close ( ) ; throw e ; } out . flush ( ) ; out . close ( ) ; }
target:  Streams content from InputStream to the ServletOutputStream This method will close the ServletOutputStream when finished This method does not close the InputSteam passed