Share via


InputStream.NullInputStream Method

Definition

Returns a new InputStream that reads no bytes.

[Android.Runtime.Register("nullInputStream", "()Ljava/io/InputStream;", "", ApiSince=33)]
public static System.IO.Stream? NullInputStream ();
[<Android.Runtime.Register("nullInputStream", "()Ljava/io/InputStream;", "", ApiSince=33)>]
static member NullInputStream : unit -> System.IO.Stream

Returns

an InputStream which contains no bytes

Attributes

Remarks

Returns a new InputStream that reads no bytes. The returned stream is initially open. The stream is closed by calling the close() method. Subsequent calls to close() have no effect.

While the stream is open, the available(), read(), read(byte[]), read(byte[], int, int), readAllBytes(), readNBytes(byte[], int, int), readNBytes(int), skip(long), skipNBytes(long), and transferTo() methods all behave as if end of stream has been reached. After the stream has been closed, these methods all throw IOException.

The markSupported() method returns false. The mark() method does nothing, and the reset() method throws IOException.

Added in 11.

Java documentation for java.io.InputStream.nullInputStream().

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