[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Buffered file stream
Source position: objects.pp line 341
type TBufStream = object(TDosStream) |
||
|
Last file open mode |
|
|
Size of buffer |
|
|
Pointer to current position in buffer |
|
|
End of data in buffer. |
|
|
Actual buffer |
|
constructor Init(); |
|
Initialize an instance of TBufStream and open the file. |
destructor Done; virtual; |
|
Close the file and cleans up the instance. |
procedure Close; virtual; |
|
Flush data and Close the file. |
procedure Flush; virtual; |
|
FLush data from buffer, and write it to stream. |
procedure Truncate; virtual; |
|
Flush buffer, and truncate the file at current position. |
procedure Seek(); virtual; |
|
Set current position in file. |
procedure Open(); virtual; |
|
Open the file if it is closed. |
procedure Read(); virtual; |
|
Read data from the file to a buffer in memory. |
procedure Write(); virtual; |
|
Write data to the file from a buffer in memory. |
end; |
|
Buffered file stream |
|
|
DOS file stream |
|
|
Base stream class |
|
|
Basis of all objects |
Bufstream implements a buffered file stream. That is, all data written to the stream is written to memory first. Only when the buffer is full, or on explicit request, the data is written to disk.
Also, when reading from the stream, first the buffer is checked if there is any unread data in it. If so, this is read first. If not the buffer is filled again, and then the data is read from the buffer.
The size of the buffer is fixed and is set when constructing the file.
This is useful if you need heavy throughput for your stream, because it speeds up operations.