java二维码--QRCode解析问题

来源:互联网 发布:海洋cms漏洞 编辑:程序博客网 时间:2024/06/04 19:43
public static void main(String[] args) {File file = new File("G:/imooc/code/qrCodeImg.png");try {BufferedImage bi = ImageIO.read(file);QRCodeDecoder decoder = new QRCodeDecoder();System.out.println("开始解析...");byte[] data = decoder.decode(new MyQRCodeImage(bi));String result = new String(data , "UTF-8");System.out.println("解析出来的数据为:" + result);} catch (DecodingFailedException dfe) {              System.out.println("Error: " + dfe.getMessage());             dfe.printStackTrace();        } catch (UnsupportedEncodingException e) {              e.printStackTrace();          } catch (IOException e) {e.printStackTrace();}  }

在做QRCode测试解析二维码的时候报了这个错误

Error: Give up decodingjp.sourceforge.qrcode.exception.DecodingFailedException: Give up decodingat jp.sourceforge.qrcode.QRCodeDecoder.decode(QRCodeDecoder.java:88)at cn.zhang.qrcode.ReadQRCode_test.main(ReadQRCode_test.java:29)
在网上查了很多资料,没有找到解决办法

原创粉丝点击