/**
* 把图片转为base64并添加到map
* @param map 数据源
* @param name 添加到map的名字
* @param realPath 路径及名字
* @throws IOException
*/
public void addSignature(Map map,String name,String realPath) throws IOException {
File file = new File(realPath);
FileInputStream fin4 = new FileInputStream(file);
byte[] bytes4 = new byte[fin4.available()];
fin4.read(bytes4);
fin4.close();
BASE64Encoder encoder4 = new BASE64Encoder();
map.put(name, encoder4.encode(bytes4));
}
java把图片转为base64
最新推荐文章于 2024-05-21 10:23:42 发布