JAVA BufferedImage bi1 =ImageIO.read(InputStream) 出错! 20
Stringcode="登机牌qr码图片字节流转码后的字符串";try{sun.misc.BASE64Decoderdecoder=newsun.misc.BASE64D...
String code = "登机牌qr 码图片字节流转码后的字符串";
try {
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
byte[] bytes1 = decoder.decodeBuffer(code);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes1);
BufferedImage bi1 =ImageIO.read(bais);
File w2 = new File("E://EBP.png");//可以是jpg,png,gif 格式
ImageIO.write(bi1, "png", w2);
} catch (IOException e) {
e.printStackTrace();
} 展开
try {
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
byte[] bytes1 = decoder.decodeBuffer(code);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes1);
BufferedImage bi1 =ImageIO.read(bais);
File w2 = new File("E://EBP.png");//可以是jpg,png,gif 格式
ImageIO.write(bi1, "png", w2);
} catch (IOException e) {
e.printStackTrace();
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询