maxIOSize

Type: Integer

The maxIOSize property of the File class contains the maximum size in bytes of an I/O operation. A read or write operation that is larger than the value of maxIOSize property is performed in a number of I/O operations, which do not exceed the value of maxIOSize property.

The default value of zero (0) units performs the read or write as a single I/O operation.

The code fragment in the following example shows the use of the maxIOSize property.

    create file transient;
    file.mode := File.Mode_Output;
    file.kind := File.Kind_Binary;
    file.fileName := "\\host\share\filename.dat";
    file.maxIOSize := 16*1024;  //16KB I/O's
    file.open;
    buffer[80*1024*1024] := 'x'.Binary;  // Create an 80MB buffer
    file.writeBinary(buffer);

This causes 5120 write I/O operations each 16K bytes in size to the destination file, rather than a single 80M byte write that would fail under current Windows operating systems raising an exception (5040 - Insufficient System Resources).

If the file is opened in shared mode and concurrent updates are allowed, data could become interleaved with other operating system processes writing to the same file. This issue would also arise, without using the maxIOSize property, if the code fragment was changed to perform a number of smaller write operations.