All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fengwenyi.javalib.file.IOUtils Maven / Gradle / Ivy

There is a newer version: 3.0.1
Show newest version
package com.fengwenyi.javalib.file;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;

/**
 * IO工具类
 * @author Erwin Feng[[email protected]]
 * @since 2019/12/24
 */
public class IOUtils {

    /**
     * byte[] 转成 BufferedImage
     * @param data byte[]
     * @return BufferedImage
     * @throws IOException IO异常
     */
    public static BufferedImage toImage(byte[] data) throws IOException {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(data);
        return ImageIO.read(byteArrayInputStream);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy