2 回答

TA貢獻2080條經驗 獲得超4個贊
問題是你使用的是使用Zlib壓縮算法的java的膨脹類。然而,在UIDAI安全QR碼中,正在使用GZip壓縮算法。因此,解壓縮邏輯必須修改如下:
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ByteArrayInputStream in = new ByteArrayInputStream(data);
GZIPInputStream gis = new GZIPInputStream(in);
byte[] buffer = new byte[1024];
int len;
while((len = gis.read(buffer)) != -1){ os.write(buffer, 0, len);
}
os.close();
gis.close();
}
catch (IOException e) {
e.printStackTrace();
return null;
}
byte[] output = os.toByteArray();
添加回答
舉報