https://blog.csdn.net/yixin605691235/article/details/80939055
public static void fun() {
try {
BASE64Encoder base64Encoder = new BASE64Encoder();
webptest4 server = new webptest4();
byte[] b=server.stringToByte(aa);
InputStream stream = new ByteArrayInputStream(b);
BufferedImage im = ImageIO.read(stream);
ByteArrayOutputStream outStream =new ByteArrayOutputStream();
ImageIO.write(im, "png", outStream);
byte [] data = outStream.toByteArray();
String str = base64Encoder.encode(data);
generateImage(str,"D:/test/2/444.png");
// BASE64Decoder base64Decoder = new BASE64Decoder();
// //解密字符串转字节数组
// byte [] bs = base64Decoder.decodeBuffer(str);
// //创建字节写入流
// OutputStream imgOut = new FileOutputStream("D:/test/2/444.png");
// imgOut.write(bs);
// //关闭流
// imgOut.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}