Sdílet prostřednictvím


RandomAccessFile.ReadLine Method

Definition

Reads the next line of text from this file.

[Android.Runtime.Register("readLine", "()Ljava/lang/String;", "")]
public string? ReadLine ();
[<Android.Runtime.Register("readLine", "()Ljava/lang/String;", "")>]
abstract member ReadLine : unit -> string
override this.ReadLine : unit -> string

Returns

the next line of text from this file, or null if end of file is encountered before even one byte is read.

Implements

Attributes

Exceptions

if this file is closed or another I/O error occurs.

Remarks

Reads the next line of text from this file. This method successively reads bytes from the file, starting at the current file pointer, until it reaches a line terminator or the end of the file. Each byte is converted into a character by taking the byte's value for the lower eight bits of the character and setting the high eight bits of the character to zero. This method does not, therefore, support the full Unicode character set.

A line of text is terminated by a carriage-return character ('\u005Cr'), a newline character ('\u005Cn'), a carriage-return character immediately followed by a newline character, or the end of the file. Line-terminating characters are discarded and are not included as part of the string returned.

This method blocks until a newline character is read, a carriage return and the byte following it are read (to see if it is a newline), the end of the file is reached, or an exception is thrown.

Java documentation for java.io.RandomAccessFile.readLine().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to