如何将ByteArrayInputStream转换为文件或图像

我有这个代码

def test(base64:String){Logger.debug(“ImageHelper.test”)

var test = Base64.getDecoder.decode(base64);   

// var input_stream: ByteArrayInputStream = new ByteArrayInputStream(test);
var input_stream = new ByteArrayInputStream(test);

// var final_buffered_image: BufferedImage = ImageIO.read(input_stream);

// ImageIO.write(final_buffered_image , "jpg", new File("final_file.jpg") );

    val size100     = Image.fromStream(new FileInputStream(base64)).scaleTo(100, 100)
// val size100   = Image.fromStream(input_stream).scaleTo(100, 100) }

如何将input_stream变量(ByteArrayInputStream)转换为文件或图像?

回答(0)