Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
/img/help/home.gif

TECLFileStream.Create

TECLFileStream


Creates an instance of TECLFileStream.

 

constructor Create(const FileName: string; Mode: Word; Password: string = ''; CompressLevel: TECLCompressionLevel = eclNone; CustomHeaderSize: Integer = 0);

 

Description

Call Create to instantiate a file stream for reading from or writing to the named file. Specify the name of the file and the way the file should be opened as parameters.

 

The Mode parameter indicates how the 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.

 

A 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 compressed file or to open an existing encrypted file. If the encrypted file is open and the Password doesn't match the password that was used to encrypt the file then Create raises an exception

 

CompressLevel indicates the level of compression to be used for the created stream. If you open the existing file TECLFileStream detects it if this is a ECL compressed file or normal file and if it's an ECL file the compression level is determined. If this file is a normal non-compressed file then it is simply opened and the CompressionLevel property is set to eclNone.

 

Specify the CustomHeaderSize parameter to set the number of bytes in the custom not compressed header. This custom header could be used to store user information that will not be compressed or encrypted. See also help for CustomHeaderSize property.

 

Note:

If you want to know if the compressed file is encrypted, i.e. password protected before opening it you may use the IsECLFileEncrypted function.

 

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Apr 20, 2024