The read method is offered in two variants, one in which the record read is provided as a result in a newly generated Record object, and a second in which a Record object transferred by the calling program as an argument is filled with the data of the record read.
When a record buffer is created, it has precisely the same size as the data read. If the calling program provides the Record object, it must ensure that the record buffer is large enough to contain the data of the record to be read. If the specified record buffer is too small to contain all the data, an exception is triggered and no data is transferred.
The read() methods read the record at the current file position. The current file position is subsequently incremented by one, in other words the next record in the array is automatically positioned on.