System.Classes.TBufferedFileStream.Create
Delphi
constructor Create(const AFileName: string; Mode: Word; BufferSize: Integer = 32768); overload;
constructor Create(const AFileName: string; Mode: Word; Rights: Cardinal; BufferSize: Integer = 32768); overload;
C++
__fastcall TBufferedFileStream(const System::UnicodeString AFileName, System::Word Mode, int BufferSize)/* overload */;
__fastcall TBufferedFileStream(const System::UnicodeString AFileName, System::Word Mode, unsigned Rights, int BufferSize)/* overload */;
/* TFileStream.Create */ inline __fastcall TBufferedFileStream(const System::UnicodeString AFileName, System::Word Mode)/* overload */ : TFileStream(AFileName, Mode) { }
/* TFileStream.Create */ inline __fastcall TBufferedFileStream(const System::UnicodeString AFileName, System::Word Mode, unsigned Rights)/* overload */ : TFileStream(AFileName, Mode, Rights) { }
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
constructor | public | System.Classes.pas System.Classes.hpp |
System.Classes | TBufferedFileStream |
Description
Creates an instance of TBufferedFileStream.
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 (possibly) a share mode or'ed together. The open mode must be one of the following values:
Value | Meaning | Declared In |
---|---|---|
Create a file with the given name. If a file with the given name exists, override the existing file and open it in write mode. |
||
Open the file for reading only. |
||
Open the file for writing only. Writing to the file completely replaces the current contents. |
||
Open the file to modify the current contents rather than replace them. |
The share mode must be one of the following values:
Value | Meaning | Declared In |
---|---|---|
Sharing is compatible with the way FCBs are opened. |
||
Other applications cannot open the file for any reason. |
||
Other applications can open the file for reading but not for writing. |
||
Other applications can open the file for writing but not for reading. |
||
No attempt is made to prevent other applications from reading from or writing to the file. |
Note: On Windows, the
Rights
parameter is ignored.
The BufferSize
parameter determines the size of the buffer used to read from or write to the file.
If the file cannot be opened, Create raises an exception.