altavir
02/24/2020, 8:38 AMBytes
though. Will it be possible to use bytes for multi-read operations? The major problem for me so far was that once input is called on Bytes
, it becomes invalid. If this is still the case, I will still need to introduce Binary
for lazy multi-read and I think that the API should be somehow changed to avoid rereading Bytes
object.e5l
02/25/2020, 8:33 AMBytes
internal, and provide BytesInput/BytesOutput
instead(with size
and remaining
). BytesInput
should work well for caching purposes via preview
and discard
. Could you tell me if you have different usecases to cover?altavir
02/25/2020, 9:40 AMInput
fill it via Output
and be able to read from it multiple times in different places in code (and be sure it won't be deleted until GC hits). The API for such binary blocks could be completely external, but for one point. ByteArray
is not the only structure that has this behavior. The same goes for random access files. It does not make sense to polute memory with long-living large objects. when you can re-read from file. My proposal is to introduce this Binary interface for multi-reads, then add one method to Input API, which will allow to read a Binary with given length. For most Inputs it will use default ByteArray inplementation, but for specific inputs like ByteArrayInput or FileInput, it could use more optimized approach (view-based for arrays and file-system based for files).jimn
03/03/2020, 8:01 AMThe same goes for random access files. It does not make sense to polute memory with long-living large objects. when you can re-read from file.mmap ^
altavir
03/03/2020, 8:08 AMjimn
03/04/2020, 5:27 AMjimn
03/04/2020, 5:28 AMjimn
03/04/2020, 5:30 AMjimn
03/04/2020, 5:31 AMaltavir
03/04/2020, 7:08 AMjimn
03/04/2020, 7:11 AMaltavir
03/04/2020, 7:13 AMjimn
03/04/2020, 7:18 AMaltavir
03/04/2020, 7:22 AMjimn
03/04/2020, 7:30 AMjimn
03/04/2020, 7:33 AM