标签:return throws bsp encoder 转换 ble tin file 字符串
public String fileToStr(MultipartFile file) throws IOException{
bate[] data = null;
InputStream is = file.getInputStream();
data = new byte[is.available()];
is.read(data);
is.close();
String encode = Base64.getEncoder().encodeToString(data);
String pre ="data:image/png;base64,"; // 加上前缀,用于html img标签显示成图片
return pre +encode;
}
标签:return throws bsp encoder 转换 ble tin file 字符串
原文地址:https://www.cnblogs.com/dayuss/p/11572102.html