最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

沒(méi)有報(bào)紅,運(yùn)行時(shí)出錯(cuò)

? int w = 300;
? ? ? ?int h = 300;
? ? ? ?String formt = ".png";
? ? ? ?String content = "www.baidu.com";
// ? ? ? ?定義二維碼參數(shù)
? ? ? ?HashMap hints = new HashMap();
? ? ? ?hints.put(EncodeHintType.CHARACTER_SET, "utf-8");//字符集
? ? ? ?hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);//出錯(cuò)等級(jí)
? ? ? ?hints.put(EncodeHintType.MARGIN, 2);//邊距,生成的二維碼的空白部分,默認(rèn)是5
// ? ? ? ?生成
? ? ? ?try {
? ? ? ? ? ?BitMatrix encode = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, w, h, hints);
// ? ? ? ? ? ?生成二維碼
? ? ? ? ? ?Path file = new File("G:/img.png").toPath();
? ? ? ? ? ?MatrixToImageWriter.writeToPath(encode,formt,file);

? ? ? ?} catch (Exception e) {
? ? ? ? ? ?e.printStackTrace();
? ? ? ?}

運(yùn)行后:

java.io.IOException: Could not write an image of format .png to G:\img.png

正在回答

1 回答

已經(jīng)解決了,定義類(lèi)型的時(shí)候多寫(xiě)了個(gè).

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

沒(méi)有報(bào)紅,運(yùn)行時(shí)出錯(cuò)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)