Product Site

5.2.4.14. lines

Returns the number of lines that are available for input if no option or option Count is specified. If the stream has already been read with charIn this can include an initial partial line. If no data remains, lines returns 0. For persistent streams the count starts at the current read position. As such, lines reports whether a read action of charIn or lineIn will succeed. Option Count is the default.

If option Normal is specified, lines returns .true if at least one line remains in the stream, or .false if no lines remain.

Note

lines("Count") determines the actual number of lines by scanning the stream starting at the current position and counting the lines. For large streams, this can be a time-consuming operation. Therefore, avoid the use of lines() or lines("Count") in the condition of a loop reading a stream. It is recommended that you use lines("Normal") or the chars method instead.

For an explanation of input and output, see Chapter 14, Input and Output Streams.

For a Queue instance, the inherited method lines returns the actual number of lines in the queue.