qrcode/src/main/java/com/xiongyingqi/qrcode/QRCode.java
public File encode(Profile profile) {
        try {
            File isFile = new File(profile.getPath());
            if (!isFile.exists()) {
                isFile.mkdirs();
            }

            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
            String fileName = UUID.randomUUID() + "." + profile.getFormat();
//            String url = zxing.getPath() + fileName;
            File file = new File(profile.getPath(), fileName);
//            writeToFile(bitMatrix, profile.getFormat(), file, profile.isLogoFlag(), profile.getLogoPath());
            BufferedImage bufferedImage = encodeToBufferedImage(profile);
            ImageIO.write(bufferedImage, profile.getFormat(), file);
            return file;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
public File encode(Profile profile) {
        try {
            File isFile = new File(profile.getPath());
            if (!isFile.exists()) {
                isFile.mkdirs();
            }

            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
            String fileName = UUID.randomUUID() + "." + profile.getFormat();
//            String url = zxing.getPath() + fileName;
            File file = new File(profile.getPath(), fileName);
//            writeToFile(bitMatrix, profile.getFormat(), file, profile.isLogoFlag(), profile.getLogoPath());
            BufferedImage bufferedImage = encodeToBufferedImage(profile);
            ImageIO.write(bufferedImage, profile.getFormat(), file);
            return file;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
public File encode ( Profile profile ) { try { File isFile = new File ( profile . getPath ( ) ) ; if ( ! isFile . exists ( ) ) { isFile . mkdirs ( ) ; } SimpleDateFormat sdf = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ; String fileName = UUID . randomUUID ( ) + "." + profile . getFormat ( ) ; //            String url = zxing.getPath() + fileName; File file = new File ( profile . getPath ( ) , fileName ) ; //            writeToFile(bitMatrix, profile.getFormat(), file, profile.isLogoFlag(), profile.getLogoPath()); BufferedImage bufferedImage = encodeToBufferedImage ( profile ) ; ImageIO . write ( bufferedImage , profile . getFormat ( ) , file ) ; return file ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; }
生成QRCode二维码
生成QRCode二维码