【发布时间】:2015-08-04 05:01:30
【问题描述】:
我正在尝试将 Base64 转换为 JAVA 中的 Blob,到目前为止,我已经开发了这段代码并且它正在工作,但它不是 Blob:
public static BufferedImage decodeToImage(String imageString) {
BufferedImage image = null;
byte[] imageByte;
try {
BASE64Decoder decoder = new BASE64Decoder();
imageByte = decoder.decodeBuffer(imageString);
ByteArrayInputStream bis = new ByteArrayInputStream(imageByte);
image = ImageIO.read(bis);
bis.close();
} catch (Exception e) {
e.printStackTrace();
}
return image;
}
我想我必须将 bufferedImage 转换为 byteArray ?我怎样才能改进我的代码?如果我什至不接近,我怎么能做对?
【问题讨论】:
-
如果你已经有字节就不需要读取图像了...
标签: java base64 bytearray blob