I'm trying to read this POST request and extract the image. Then save it to disk, but the buffered image is null
Here is the code (the main part):
private void handleImage(String target, Request baseRequest, HttpServletRequest request,
HttpServletResponse response) throws Exception{
InputStream inStream = request.getInputStream();
byte[] body = IOUtils.toByteArray(inStream);
InputStream in = new ByteArrayInputStream(body);
BufferedImage bImageFromConvert = ImageIO.read(in);
ImageIO.write(bImageFromConvert, "png", new File(
"hi.png"));