How to deserialize streaming and detect the end of stream correctly? #202
Unanswered
marcwittke
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Yeah, that’s a good question. At the decoding level, the library could handle that case better—seems like The better solution is probably something like an Object Container File (#156). You could also make a simpler envelope, such as by writing out the record count at the beginning of the file. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given a binary deserializer of
Record
and a huge gzip stream with serialized records, how do I detect the end of stream correctly?This test demonstrates the problem:
Currently, the test deserializes the 100.000 records, but ends with an exception when it reaches the end of the underlying stream:
I also tried to stop when the underlying gzip stream position is at the end, but that will result in the loss of data, since the buffer still contains unread records when this happens.
Beta Was this translation helpful? Give feedback.
All reactions