Search code examples
javakotlinrandomaccessfile

Analog of raf.seek(pos)


I wanna find analog of raf.seek(pos) method from java. Need to find page by number in text file (book's page).

val raf = RandomAccessFile(file, "r")
raf.seek(pageNumber * PAGE_SIZE)
raf.read(bytePage)

I don't like my version. It's too java oriented. Wanna find other way. W/o byte array maybe.


Solution

  • Even when you look at the android side of things, you will find that RandomAccessFile is in deed coming out of the java standard libraries.

    In other words: there is no specific "kotlin'ized" version of that class.

    Thus the answer is: up to now, you have to go with your "java'ish" looking code.