[fpc-pascal] How to poll for a byte in Input?

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Fri Dec 9 19:41:06 CET 2011


I think the main problem is that TStream tries to abstract two kinds
of resources :

Character based resources and block based resources. The end result is
that it is no good for neither of the two cases.

2011/12/9 Michael Van Canneyt <michael at freepascal.org>:
>
>
> On Fri, 9 Dec 2011, Jorge Aldo G. de F. Junior wrote:
>
>> Thats an old problem on the way TStream was implemented.
>>
>> I for one needed to know the result size of a uncompress stream (IE.:
>> i have a compressed stream and want to know in advance how many bytes
>> the uncompress method would yield).
>
>
> This information is not stored in the compressed data. To be able to give
> you this number, the compression stream
> would need to actually decompress the whole stream.
>
>
>>
>> The stream system is currently a mess, sometimes you can know in
>> advance how many bytes you can read, sometimes you cant, depends on
>> the class you are dealing with.
>
>
> There are simply streams which have no size.
>
> In each case, I am working on the 'StreamCapabilities' property, which
> should be able to tell you what is available.
>
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list