[-list]FYI Given the lack of responses, I think more context would help. For example github / gist link to code, minimal case to reproduce.
2018-02-23 16:59 GMT+01:00 Quentin Liu <quentin.liu.0415@gmail.com>:
Hi,
I am using Data.Binary to decode binary files and found that the `runGet` function would throw an exception “not enough bytes” even though it has not consumed all the input.
Specifically, in the loop I am repeatedly trying to parse the binary file until it has consumed all the input
parsePPackets xs = do
empty <- isEmpty
if empty
then return xs
else do p <- parseB6034
parsePPackets (p:xs)
When I try to run this function with `runGet`, the exception “Data.Binary.Get.runGet at position 3293603: not enough bytes” would be thrown, while the total length of input is 5864230, a number significantly larger. The function `parseB6034` consumes no more than 250 bytes in each round. In addition, the `parsePPackets` works well when fed with a small amount of data.
Is it the problem of my code or an error with the package binary? The ByteString fed into `runGet` is lazy ByteString, as required by `runGet` function.
Best Regards,
Qingbo Liu
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.