tfilestream

Sequential Multi-Threading

好久不见. 提交于 2020-01-06 20:01:39
问题 I wanna build Multi-Threaded procedure for the following code, but not able to correctly build it. I tried using Semaphore to sequentially complete the code but it only executed the myStream2.CopyFrom(myStream1, StrToInt64('$' + SL1[(i - 1)])); part which comes under else part. The problem presents is that if we restore those streams into output filestream (mystream2) haphazardly, the file will corrupt. Can anyone help me please. for i := 1 to SL1.Count do begin if Length(SL1[i - 1]) > 12

Delphi TFileStream.Seek, how to check for invalid seek offset

匆匆过客 提交于 2019-12-24 04:55:14
问题 I am working with TFileStream in Delphi 2006. When I invoke TFileStream.Seek with an offset that is out of bounds I am getting different return values. When I seek to a position below the beginning of the stream, the function returns -1 and if I seek to a beyond the stream size, the function returns what would have been the position in the stream if the stream was that large. Is there a way to check whether a seek operation on the stream was successful? Why does TFileStream.Seek not fail when

how to detect if tfilestream has been freed?

 ̄綄美尐妖づ 提交于 2019-12-11 09:58:15
问题 is there a way to see if an instace of tfile stream is being used? for example if i declare FS of type tfilestream,write buffer to it and finally free the stream using tfilestream.free can i check something like: if tfilestream.NotActive then //code if tfilestream.beingused then //code if tfilestream.free = true then //code active and beingused methods do not exists for real nor can we test tfilestream.free = true just making this up to give idea what i am trying to ask 回答1: You can't do it

TDownloadURL cannot download from HTTPS

不羁岁月 提交于 2019-12-07 02:13:33
问题 I've been trying to create (TFileStream) a PDF through the TDownloadURL class, but I'm really having troubles in obtaining the file/stream from the URL, specially if the URL a HTTPS. I'm not sure if I was clear, but I will post a snippet so it might help understanding: implementation var pdfStreamed: TDownloadUrl; var fileStream : TFileStream; procedure generateStream; begin pdfStreamed:= TDownLoadURL.Create(nil); with pdfStreamed do begin URL := 'https://farm9.staticflickr.com/8327

What is the fastest way for reading huge files in Delphi?

怎甘沉沦 提交于 2019-12-04 13:53:06
问题 My program needs to read chunks from a huge binary file with random access. I have got a list of offsets and lengths which may have several thousand entries. The user selects an entry and the program seeks to the offset and reads length bytes. The program internally uses a TMemoryStream to store and process the chunks read from the file. Reading the data is done via a TFileStream like this: FileStream.Position := Offset; MemoryStream.CopyFrom(FileStream, Size); This works fine but

(Wide)String - storing in TFileStream, Delphi 7. What is the fastest way?

对着背影说爱祢 提交于 2019-11-30 15:37:29
问题 I'm using Delphi7 (non-unicode VCL), I need to store lots of WideStrings inside a TFileStream. I can't use TStringStream as the (wide)strings are mixed with binary data, the format is projected to speed up loading and writing the data ... However I believe that current way I'm loading/writing the strings might be a bottleneck of my code ... currently I'm writing length of a string, then writing it char by char ... while loading, first I'm loading the length, then loading char by char ... So,

(Wide)String - storing in TFileStream, Delphi 7. What is the fastest way?

假如想象 提交于 2019-11-30 14:34:11
I'm using Delphi7 (non-unicode VCL), I need to store lots of WideStrings inside a TFileStream. I can't use TStringStream as the (wide)strings are mixed with binary data, the format is projected to speed up loading and writing the data ... However I believe that current way I'm loading/writing the strings might be a bottleneck of my code ... currently I'm writing length of a string, then writing it char by char ... while loading, first I'm loading the length, then loading char by char ... So, what is the fastest way to save and load WideString to TFileStream? Thanks in advance Rob Kennedy