reset(): This method is available in java.io.BufferedInputStream class of Java.
Syntax:
void java.io.BufferedInputStream.reset() throws IOException
If mark pos is -1(no mark has been set or the mark has been invalidated), an IOExceptionis thrown. Otherwise, pos is set equal to mark pos.
Parameters: NA
Returns: NA
Throws:
IOException - if this stream has not been marked or, if the mark has been invalidated, or the stream has been closed by invoking its close()method or an I/O error occurs.
Approach
Java
import java.io.BufferedInputStream;import java.io.IOException;import java.io.InputStream;public class BufferedInputStreamreset {public static void main(String[] args) throws IOException {InputStream inputStream = InputStream.nullInputStream();BufferedInputStream bufferedInputStream =new BufferedInputStream(inputStream);bufferedInputStream.reset();System.out.println(bufferedInputStream);}}
Output:
Exception in thread "main" java.io.IOException: Resetting to invalid mark at java.base/java.io.BufferedInputStream.reset(BufferedInputStream.java:446)
No comments:
Post a Comment