Search code examples
javaspringqr-codezxing

How to set qrcode file permission to 755 using zxing qr generator in java spring?


Executing the code below return file permission : "-rw-r-----"

I don't want to change the file permission manually, is there any way to change it programmatically

 public static void generateQRCodeImage(String text, int width, int height, String filePath)
            throws WriterException, IOException {
        QRCodeWriter qrCodeWriter = new QRCodeWriter();
        BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height);

        Path path = FileSystems.getDefault().getPath(filePath);
   
        MatrixToImageWriter.writeToPath(bitMatrix, "jpg", path);

    }

Solution

  • Done, with posixfilepermission