private byte[] inputToByte(InputStream inStream) throws IOException {
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100];
int rc = 0;
while ((rc = inStream.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in2b = swapStream.toByteArray();
return in2b;
}
妈嗨,被网上的代码坑了怒传代码
codeHexStr = new String(Hex.encodeHex(in2b));
这个是把图片数组转成Hex值的方法。麻蛋也是被坑了。