Daniël Mantione wrote:
I agree, but I would like to be carefull about one thing: zstreams read
from pipes or sockets. If someone closes a socket zstream early, a seek to
end would result in an exception. Is there a way we can detect a stream to
be seekable?
Probably no, and it's (sometimes) a badly needed feature.
However, two solutions come to my mind:
1) Ignore that particular exception. Not very good, because excessive
data will still be read from the source stream.
2) Add a property, something like "MaxSourceSize", and limit
decompression stream to read no more than that many bytes from the
source. Of course, this size must be known beforehand, but usually
sequential streams are arranged in a way that it is known. Or, maybe
zlib data header already contains this size?
Sergei
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel