The listElements(..) method actually lists the elements. Again we will
go through it line-by-line.
public String listElements (double start, int elements, String format, int flags) {
Data data = getDataBuffer(elements); // 1
seek(start); // 2
int numRead = read(data, elements); // 3
if (numRead <= 0) return null; // 4
return data.toString(0, numRead, 10)+"\n"; // 5
}
-
Line 1: Create a data buffer to use when reading in the data.
-
Line 2: Seek to the start of the data we wantr to read.
-
Line 3: Read in the data.
-
Line 4: If there was nothing available to read (e.g. end-of-file),
just return null.
-
Line 5: Convert the data to a string. In this case we are converting
to test starting at 0 with numElements total and using
base-10. By convention, this always has a newline character added
on to the end of the string.