content="data:image/jpeg;base64,/dsgsgsd...";
Pattern pattern=Pattern.compile("data:image/(.*?);base64,");
Matcher matcher=pattern.matcher(content);
String type="";
if(matcher.find()){
type=matcher.group(1);
}else{
return;
}
String base64=content.replaceAll(matcher.group(0),"");
byte[] buffer=new BASE64Decoder().decodeBuffer(base64);
//转为字节流或者文件
ByteArrayInputStream bis=new ByteArrayInputStream(buffer);
处理Base64的图片
最新推荐文章于 2024-09-10 10:57:07 发布