[Overview][Constants][Classes][Index] Reference for unit 'bufstream' (#fcl)

TBufferedFileStream.Write

Writes the specified number of bytes in Buffer to the internal page buffer(s)

Declaration

Source position: bufstream.pp line 133

public function TBufferedFileStream.Write(

  const Buffer;

  Count: LongInt

):LongInt; override;

Arguments

Buffer

  

Buffer with the values written in the method

Count

  

Number of bytes requested in the write operation

Function result

Actual number of bytes written in the method

Description

Write is a LongInt function used to write byte values in Buffer to the current position in the buffered file stream. Count contains the number of bytes requested in the write operation.

Write is overridden to use the internal buffer in the operation instead of the underlying file stream. It locates the page in the buffer with the content for the buffered stream position.

Write maintains the pages in the buffer as needed for the request. This includes recycling older buffer pages, reading values from the stream for a new buffer page, and storing the new content in the internal buffer.

Buffer contains the values stored in the internal buffer in the request. The return value contains the actual number of bytes written, or 0 if the write could not be performed.

Use Seek or Position to set the buffer position (when needed) prior to calling Write.

Errors

Write raises an EStreamError exception with the message in SErrCacheUnexpectedPageDiscard when a page has been unexpectedly discarded in the buffer.

See also

TBufferedFileStream.Seek

  

Moves the position in the buffer relative to the specified origin

TBufferedFileStream.GetPosition

TBufferedFileStream.SetPosition

THandleStream.Write

TStream.Write

TStream.Position

EStreamError


Documentation generated on: May 14 2021