Unit 'bufstream' Package
[Overview][Constants][Classes][Index] [#fcl]

TBufferedFileStream.Create

Constructor for the class instance.

Declaration

Source position: bufstream.pp line 134

public constructor TBufferedFileStream.Create(

  const AFileName: string;

  Mode: Word

);

constructor TBufferedFileStream.Create(

  const AFileName: string;

  Mode: Word;

  Rights: Cardinal

);

Arguments

AFileName

  

File name with the content for the buffered file stream.

Mode

  

File mode used to open the file.

Arguments

AFileName

  

File name with the content for the buffered file stream.

Mode

  

File mode used to open the file.

Rights

  

File rights used to open the file.

Description

Create is the constructor for the class instance. Overloaded variants are provided to match the constructors used in the ancestor class (TFileStream).

Create ensures that resources are allocated for the internal buffer. By default, the buffer reserves 8 blocks (pages) with 4,096 bytes per block (page). Create calls InitializeCache to allocate resources needed for the internal buffer.

Create calls the inherited constructor using the parameter values passed to the method.

AFileName is the qualified path to the file where the content in the stream is stored.

Mode contains the file mode used for the file handle in the ancestor class. It uses the following file mode constant values:

fmCreate
Creates the file it does not already exist.
fmOpenRead
Opens the file for read-only access.
fmOpenWrite
Opens the file for write-only access.
fmOpenReadWrite
Opens the file for read / write access.

The file mode constants (except for fmCreate) can be OR'd with sharing mode constants, including:

fmShareCompat
Opens the file in DOS-compatibility sharing mode.
fmShareExclusive
Locks the file for exclusive use.
fmShareDenyWrite
Locks the file and denies write access to other processes.
fmShareDenyRead
Locks the file and denies read access to other processes.
fmShareDenyNone
Does not lock the file.

Rights contains the value used as the file mode on UNIX-like file systems. It contains a value representing the read, write, execute, sticky-bit, setgid, and setuid flags used on the platform. It is ignored for all other platforms, and is significant only when using fmCreate in Mode.

The Size for the internal buffer is updated to use the length of the file stream.

See also

TBufferedFileStream.InitializeCache

  

Re-initializes the internal buffer for the buffered file stream.

TBufferedFileStream.Size

TFileStream.Create

TFileStream.Size


Documentation generated on: Dec 27 2024