工具类
public static BufferedInputStream base64Convert(String base64) {
// 解码
base64 = base64.split(",")[1];
try {
byte[] buffer = Base64.getMimeDecoder().decode(base64);
for (int i = 0; i < buffer.length; i++) {
if (buffer[i] < 0) {
buffer[i] += 256;
}
}
// 生成流
return new BufferedInputStream(new ByteArrayInputStream(buffer));
} catch (Exception e) {
log.info("base64解码失败");
throw new RuntimeException(e);
}
}
标签:Base64,转流,buffer,OSS,base64,BufferedInputStream,new
From: https://www.cnblogs.com/qbbit/p/17260360.html