Reputation: 11
I am working on a library to read and render PDF files in Java. PDF streams are supposed to be read incrementally, but I don't know how this would work using the FlateDecode filter, because of the way that data is compressed. I can only decode the data if the whole stream is read and decoded, and not just a part.
Is it possible at all to read data like this incrementally? Or do I need to decode it all first?
Upvotes: 1
Views: 2285
Reputation: 112349
Yes, a deflate stream can be decompressed incrementally. That is normally how it's done, using the inflate()
function in zlib. The interface to zlib's inflate in Java is the Inflater
class (unfortunately spelled wrong -- it should be Inflator).
Upvotes: 1