[fpc-devel] TBufferedFileStream

silvioprog silvioprog at gmail.com
Sun Sep 4 03:58:52 CEST 2016


On Sat, Sep 3, 2016 at 9:39 PM, José Mejuto <joshyfun at gmail.com> wrote:

> El 04/09/2016 a las 2:04, silvioprog escribió:
>
> If I understood right, did you create something like GIO or GVFS? Or
>> neither of them hehe
>>
>
> Hello,
>
> Yes and no :) It's something like GVFS but at your program level only. I
> originally develop it to be used in a forensic tool (which was not finally
> developed) to allow the same data scan engine to work in compressed files
> as they were real files so the file access logic is completly isolated from
> the information gather engine as this one works over a TVirtualFileSystem,
> how you implement your TVirtualFileSystem is up to your decision.
>
> You basically need to implement this functions:
>
> function intfOpenFile(const AFileName: UTF8String; const AMode: cardinal):
> TvlHandle; virtual; abstract;
>
[...]

Nice API.

As far as you can implement those functions yes, in fact I started (almost
> nothing) to write an http access using a remote zip file for read only and
> using the http byte ranges to access it.
>

I spent a much time working in an efficient byte serving layer, because the
company needed to provide files allowing resume of up/download contents. I
did it with raw TFileStream, but I need to spend some time testing
TBufferedFileStream, I think this class can be very useful for creating
fast layer allowing download acceleration of big files (that has sequencial
small repetitive reads), and I've already implemented a structure allowing
the following simultaneous byte range groups:

     HTTP/1.1 206 Partial Content
     Date: Wed, 15 Nov 1995 06:25:24 GMT
     Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
     Content-Length: 1741
     Content-Type: multipart/byteranges; boundary=THIS_STRING_SEPARATES

     --THIS_STRING_SEPARATES
     Content-Type: application/pdf
     Content-Range: bytes 500-999/8000

     ...the first byes range...
     --THIS_STRING_SEPARATES
     Content-Type: application/pdf
     Content-Range: bytes 7000-7999/8000

     ...the second bytes range
     --THIS_STRING_SEPARATES--

ASAP I'm going to redo my benchmarking tests replacing the TFileStream to
TBufferedFileStream and checking if I really can get any performance gain.

Maybe I should retake this work :) if there are some interest in the
> community.
>

Searching files under compressed files seems really seems a very useful
feature.


> Attached is a sample (some folder names erased) of the explorer I use to
> test the different file systems in "real" situations.


I took a look at it, thanks! :-)

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160903/62dde8af/attachment.html>


More information about the fpc-devel mailing list