Here you can find the source of getImage(byte[] imageBytes)
Parameter | Description |
---|---|
imageBytes | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static BufferedImage getImage(byte[] imageBytes) throws IOException
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.imageio.ImageIO; public class Main { /**//from w ww . j a va2s . c o m * Get a buffered image of the image bytes * * @param imageBytes * @return buffered image or null * @throws IOException * @since 1.1.2 */ public static BufferedImage getImage(byte[] imageBytes) throws IOException { BufferedImage image = null; if (imageBytes != null) { ByteArrayInputStream stream = new ByteArrayInputStream(imageBytes); image = ImageIO.read(stream); stream.close(); } return image; } }