One of the (easiest) possibilites to solve the problem is creating a ByteArrayInputStream and then passing it to ImageIO:
ByteArrayOutputStream output = new ByteArrayOutputStream();
// save the image to the output stream
ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
BufferedImage image = ImageIO.read(input);