If you try to use ttorrent on android you run into a NoMethodError due do android having an embedded commons-codec 1.2, while you're using commons-codec 1.8.
As far as I could see, you're using commons-codec for 2 simple operations that could be easily replaced. The 2 points that I found were:
1) DigestUtils.getSha1Digest()
Could be replaced by the following code:
MessageDigest.getInstance("SHA-1")
2) Hex.encodeHex
Could be replaced by the following code:
public static String byteArrayToHexString(byte[] bytes) {
final char[] toDigits = "0123456789abcdef".toCharArray();
int l = bytes.length;
char[] out = new char[l << 1];
int i = 0; for (int j = 0; i < l; ++i) {
out[(j++)] = toDigits[((0xF0 & bytes[i]) >>> 4)];
out[(j++)] = toDigits[(0xF & bytes[i])];
}
return new String(out);
}
Both codes were extracted from class files. The only thing to do other than the above is an exception that item 1) could throw.
If you try to use ttorrent on android you run into a NoMethodError due do android having an embedded commons-codec 1.2, while you're using commons-codec 1.8.
As far as I could see, you're using commons-codec for 2 simple operations that could be easily replaced. The 2 points that I found were:
1) DigestUtils.getSha1Digest() Could be replaced by the following code:
2) Hex.encodeHex Could be replaced by the following code:
Both codes were extracted from class files. The only thing to do other than the above is an exception that item 1) could throw.