Piotr Dałek wrote: > Hello! > >> Piotr Dałek wrote: >>> Hello! >>> >>>> A reliable way to calculate More was >>>> "More := Stream.Position < Stream.Size;" >>>> >>>> however that is slower since Stream.Size has to seek to the end of >>>> the stream and the back to current position on each call of >>>> DoFileEncBase64(). (Instead of Stream.Size we could also check >>>> against file size, however only with ShareMode fmShareDenyWrite). >>> >>> var >>> LocalStreamSize: integer; >>> [..] >>> LocalStreamSize := Stream.Size; >>> [..] >>> More := Stream.Position < LocalStreamSize; >>> [..] >>> >>> Problem solved. > >> I do not get this, sorry. Please elaborate. > > Get the stream size only once - store it somewhere and use stored > value instead of calling Stream.Size getter.
OK, but what will happen if the stream size changes during encoding, if for instance the component user opened the file with ShareMode fmShareDenyRead? That's why I added public property Mode to the TBufferedFileStream class and check the ShareMode in DoFileEncBase64,. in case of no problem TBufferedFileStream(Stream).FastSize is called (which is current, constant size), otherwise Stream.Size (which is slow, but who will actually open a file to be sent with ShareMode fmShareDenyRead only ? I guess not many). -- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be