java中 \r、\n 替換問題

String transferURL = JSON.parseObject(httpClientResponse.getContent()).getString("transferURL");
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        QRCodeUtil.writeToStream(transferURL, outputStream, 256, 256);
        String pngBase64 = new BASE64Encoder().encode(outputStream.toByteArray())
                .replaceAll("\\\\r", "")
                .replaceAll("\\\\n", "")
                ;
        return RtMsg.dataOk()
                .put("base64", "data:image/png;base64,"+ pngBase64);
相關文章
相關標籤/搜索