java如何使用base64生成图片文件
import org.apache.commons.codec.binary.Base64;
public static void decodeFile(String base64Str,File file) throws Exception {
FileOutputStream write = null;
try {
write = new FileOutputStream(file);
byte[] decoderBytes = Base64.decodeBase64(content.getBytes("UTF-8"));
write.write(decoderBytes);
} catch (Exception e) {
e.printStackTrace();
throw e;
}finally {
try {
if(write!=null)write.flush();
if(write!=null)write.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
不积跬步无以至千里,不积小流无以成江海