为什么如此复杂,为什么要将完整图像读入内存?一个简单得多的解决方案:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { sun.misc.base64Enprer enc = new sun.misc.base64Enprer(); enc.enpre(new FileInputStream("/path/to/file.whatever"), response.getOutputStream());}


