Partager via


InputStream.Reset Method

Definition

Repositions this stream to the position at the time the mark method was last called on this input stream.

[Android.Runtime.Register("reset", "()V", "GetResetHandler")]
public virtual void Reset ();
[<Android.Runtime.Register("reset", "()V", "GetResetHandler")>]
abstract member Reset : unit -> unit
override this.Reset : unit -> unit
Attributes

Exceptions

if this stream is closed or another IOException occurs.

Remarks

Repositions this stream to the position at the time the mark method was last called on this input stream.

The general contract of reset is:

<ul> <li> If the method markSupported returns true, then:

<ul><li> If the method mark has not been called since the stream was created, or the number of bytes read from the stream since mark was last called is larger than the argument to mark at that last call, then an IOException might be thrown.

<li> If such an IOException is not thrown, then the stream is reset to a state such that all the bytes read since the most recent call to mark (or since the start of the file, if mark has not been called) will be resupplied to subsequent callers of the read method, followed by any bytes that otherwise would have been the next input data as of the time of the call to reset. </ul>

<li> If the method markSupported returns false, then:

<ul><li> The call to reset may throw an IOException.

<li> If an IOException is not thrown, then the stream is reset to a fixed state that depends on the particular type of the input stream and how it was created. The bytes that will be supplied to subsequent callers of the read method depend on the particular type of the input stream. </ul></ul>

The method reset for class InputStream does nothing except throw an IOException.

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

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