[fpc-devel] TBufferedFileStream

José Mejuto joshyfun at gmail.com
Sun Sep 4 02:39:55 CEST 2016


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;

function intfCloseFile(const Handle: TvlHandle): Boolean; virtual; abstract;

function intfFindList(const APath: UTF8String; const AMask: UTF8String): 
TVirtualLayer_FolderList; virtual; abstract;

function intfSeek(const AHandle: TvlHandle; const APosition: int64; 
const Origin: word): int64; virtual; abstract;

function intfRead(const Handle: TvlHandle; const Buffer: PBYTE; const 
Size: int64): int64; virtual; abstract;

function intfWrite(const Handle: TvlHandle; const Buffer: PBYTE; const 
Size: int64): int64; virtual; abstract;

function intfGetFileSize(const AHandle: TvlHandle): int64; virtual; 
abstract;

function intfSetFileSize(const AHandle: TvlHandle; const ANewFileSize: 
int64): Boolean; virtual; abstract;

function intfDeleteFile(const AFileName: UTF8String): boolean; virtual; 
abstract;

function intfGetFreeSpace(const APath: UTF8String): int64; virtual; 
abstract;

function intfIsWritableMedia(): Boolean; virtual; abstract;

function intfMakeFolder(const AFolder: UTF8String): Boolean; virtual; 
abstract;

function intfRemoveFolder(const AFolder: UTF8String): Boolean; virtual; 
abstract;

function intfCopy(const ASourceFileName,ATargetFileName: UTF8String): 
Boolean; virtual;

function intfMove(const ASourceFileName,ATargetFileName: UTF8String): 
Boolean; virtual;

And you get a file system working. Of course it is a basic file system, 
without many functions and some restrictions like all the system works 
in case sensitive mode whichever the original one supports.

> Another question, does it work remotely too?

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.

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

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


-- 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: VL (2).png
Type: image/png
Size: 31921 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160904/5a2180f3/attachment.png>


More information about the fpc-devel mailing list