1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| File("/sdcard/test.bmp").also { val reader = it.reader() val charArray = CharArray(4) reader.read(charArray, 0, 2) Log.e(TAG, "id: ${charArray[0]}${charArray[1]}") reader.read(charArray, 0, 4) Log.e( TAG, "file size: ${charArray[3].toInt() * pow(16.0, 3.0) + charArray[2].toInt() * pow(16.0, 2.0) + charArray[1].toInt() * 16.0 + charArray[0].toDouble()}" ) Log.e(TAG, "file size: ${it.length() / 8}") reader.read(charArray, 0, 2) Log.e(TAG, "reserved: ${charArray[1].toInt() * 16.0 + charArray[0].toDouble()}") reader.read(charArray, 0, 2) Log.e(TAG, "reserved: ${charArray[1].toInt() * 16.0 + charArray[0].toDouble()}") reader.read(charArray, 0, 4) Log.e(TAG, "offset: ${charArray[3].toInt() * pow(16.0, 3.0) + charArray[2].toInt() * pow(16.0, 2.0) + charArray[1].toInt() * 16.0 + charArray[0].toDouble()}") }
|