Single File System: Virtual File System Delphi Library
for Archive / Backup with Transparent Compression and Strong Encryption


TSingleFileSystem.Create
TSingleFileSystem
Top 


Instantiates a single file system object.

// basic constructor
constructor Create(FileName: string; Mode: Word; Password: string = ''; Question: string = ''; Answer: string = ''; DefaultCompressionLevel: TSFSCompressionLevel = sfsNone); overload;

// advanced constructor
constructor Create(FileName: string; Mode: Word; InMemoryMode: Boolean; Password: string = ''; Question: string = ''; Answer: string = ''; DefaultCompressionLevel: TSFSCompressionLevel
















































= sfsNone; PageSize: Integer = DEFAULT_PAGE_SIZE; ExtentPageCount: Integer = DEFAULT_EXTENT_PAGE_COUNT; PartFileSize: Int64 = -1); overload;

Description
Call Create to instantiate a single file system object at runtime. Specify the name of the single file and the way the file should be opened as parameters.

The Mode parameter indicates how the single file is to be opened. The Mode parameter consists of an open mode and a share mode together. The open mode must be one of the following values:

Value    Meaning    
fmCreate   Create a file with the given name. If a file with the given name exists, open the file in write mode.   
fmOpenRead   Open the file for reading only.   
fmOpenWrite   Open the file for writing only. Writing to the file completely replaces the current contents.   
fmOpenReadWrite   Open the file to modify the current contents rather than replace them.   
   
The share mode must be one of the following values:

Value    Meaning    
fmShareCompat   Sharing is compatible with the way FCBs are opened.   
fmShareExclusive   Other applications cannot open the file for any reason.   
fmShareDenyWrite   Other applications can open the file for reading but not for writing.   
fmShareDenyRead   Other applications can open the file for writing but not for reading.   
fmShareDenyNone   No attempt is made to prevent other applications from reading from or writing to the file.   

If the file cannot be opened, Create raises an exception.

The InMemoryMode parameter specifies whether a single file is to be opened in memory or on disk.

The Password parameter value different from default blank string indicates that the data is encrypted by this password. This parameter is required to create an encrypted single file or to open an existing encrypted file. If the encrypted file is to be opened and the Password doesn't match the password that was used to encrypt the file then Create raises an exception

The Question parameter indicates a question that may be asked if a user forgot his / her password to recover the password.

The Answer parameter indicates an answer that must be given by a user to recover his/her forgotten password.

The DefaultCompressionLevel indicates a level of compression to be used for newly created files within a single file system by default.

PageSize indicates the size of single file pages in Kb, by default each page is 4Kb in size. Page is the fundamental unit of data storage in Single File System.

The ExtentPageCount parameter specifies how many pages are contained in one extent. Extents are the basic unit in which space is allocated to single file system objects.

The PartFileSize specifies size of SFS files. When this parameter is set to any positive value the Single File System will create multiple OS files to store user files when overall SFS file size will be more than PartFileSize.By default PartFileSize value is -1 and maximum available size of file part is used.

Note:
If you want to know if the single file is encrypted, i.e. password protected before opening it you may use the IsSingleFileEncrypted function.
If you want to know if the password is valid before opening a single file you may use the IsPasswordValid function.


© 2000-2004 AidAim Software LLC Single File System: Single File Syste