pull/399/head
Celeter 4 years ago committed by GitHub
parent c0c863071f
commit 0d2269d2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/src/main/java/io/legado/app/utils/StringUtils.kt

@ -295,17 +295,17 @@ object StringUtils {
fun byteToHexString(bytes: ByteArray?): String { fun byteToHexString(bytes: ByteArray?): String {
if (bytes == null) return "" if (bytes == null) return ""
val sb = StringBuilder() val sb = StringBuilder(bytes.size * 2)
for (b in bytes) { for (b in bytes) {
val hex = 0xff and b.toInt() val hex = 0xff and b.toInt()
if (hex < 16) { if (hex < 16) {
sb.append('0') sb.append('0')
} }
sb.append(Integer.toHexString(hex)).append(" ") sb.append(Integer.toHexString(hex))
} }
return sb.toString() return sb.toString()
} }
fun hexStringToByte(hexString: String): ByteArray? { fun hexStringToByte(hexString: String): ByteArray? {
val hexStr = hexString.replace(" ", "") val hexStr = hexString.replace(" ", "")
val len = hexStr.length val len = hexStr.length

Loading…
Cancel
Save