Escribir un InputStream a un HttpServletResponse
Tengo un InputStream que quiero escribir en una HttpServletResponse. Existe este enfoque, que lleva demasiado tiempo debido al uso del byte []
<code>InputStream is = getInputStream(); int contentLength = getContentLength(); byte[] data = new byte[contentLength]; is.read(data); //response here is the HttpServletResponse object response.setContentLength(contentLength); response.write(data); </code>
Me preguntaba cuál podría ser la mejor manera de hacerlo, en términos de velocidad y eficiencia.