IDataInput.ReadLine Method

Definition

Reads the next line of text from the input stream.

[Android.Runtime.Register("readLine", "()Ljava/lang/String;", "GetReadLineHandler:Java.IO.IDataInputInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public string? ReadLine ();
[<Android.Runtime.Register("readLine", "()Ljava/lang/String;", "GetReadLineHandler:Java.IO.IDataInputInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ReadLine : unit -> string

Returns

the next line of text from the input stream, or null if the end of file is encountered before a byte can be read.

Attributes

Exceptions

if the end of the input is reached before the read request can be satisfied.

if an I/O error occurs while reading.

Remarks

Reads the next line of text from the input stream. It reads successive bytes, converting each byte separately into a character, until it encounters a line terminator or end of file; the characters read are then returned as a String. Note that because this method processes bytes, it does not support input of the full Unicode character set.

If end of file is encountered before even one byte can be read, then null is returned. Otherwise, each byte that is read is converted to type char by zero-extension. If the character '\n' is encountered, it is discarded and reading ceases. If the character '\r' is encountered, it is discarded and, if the following byte converts &#32;to the character '\n', then that is discarded also; reading then ceases. If end of file is encountered before either of the characters '\n' and '\r' is encountered, reading ceases. Once reading has ceased, a String is returned that contains all the characters read and not discarded, taken in order. Note that every character in this string will have a value less than \u005Cu0100, that is, (char)256.

Java documentation for java.io.DataInput.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