jw
12/25/2020, 6:52 PMLilly
12/25/2020, 10:20 PMBufferedSource
but I think that hint helped me already. Thanks :)Lilly
12/26/2020, 1:33 PMval file = File("D:\\Test\\Infos.pak") // 500 MB
file.source().use { fileSource ->
fileSource.buffer().use { bufferedSource ->
val buffer = bufferedSource.peek()
println("Size: ${buffer.buffer.size}") // prints 0
while (true) {
buffer.skip(12)
println("Size: ${buffer.buffer.size}") // prints 8180
val offsetFiles = buffer.readLongLe()
println("offsetFiles: $offsetFiles")
buffer.skip(0x2BCB61)
println("next: ${Integer.toHexString(buffer.readInt())}") // printed bytes are false
break
}
}
}
This buffer grows with your data. Just like ArrayList, each buffer starts small. It consumes only the memory it needs to.Is 8192 bytes the max size a buffer can hold? Then I'm wondering how to read the 500 MB file once?
jessewilson
12/26/2020, 1:47 PMjessewilson
12/26/2020, 1:47 PMLilly
12/26/2020, 1:49 PMbufferedSource.inputStream()
Lilly
12/26/2020, 3:23 PMjw
12/26/2020, 3:33 PMLilly
12/26/2020, 4:33 PMjw
12/26/2020, 4:46 PM