I am using the bz2.BZ2Decompressor
class to sequentially decompress a stream of bz2 compressed data. It is possible that my stream contains truncated compressed data. I need to be able to differentiate between the case when a complete file was decompressed and when only a portion of it was decompressed. Is there any way to establish that ?
To be more elaborate, my stream of data that I supply to the decompress function may or may not be a complete bz2 compressed file. It may be truncated. When I use this function, it returns to me whatever amount it is able to decompress using the data. It does not tell me if the end of stream was reached. How do I determine the same ? The EOFError
is only raised if there is additional data after the end of stream is found. So that does not help me.