fun compXmlStringAt(arr: ByteArray, strOff: Int): String? { val strLen: Int = arr[strOff + 1] shl 8 and 0xff00 or arr[strOff] and 0xff val chars = CharArray(strLen) for (ii in 0 until strLen) { val p0 = strOff + 2 + ii * 2 if (p0 >= arr.size - 1) break chars[ii] = ((arr[p0 + 1] and 0x00FF shl 8) + (arr[p0] and 0x00FF)).toChar() } return String(chars) }
Return the string stored in StringTable format at offset strOff . This offset points to the 16 bit string length , which is followed by that number of 16 bit ( Unicode ) chars .