Java BufferedReader reset() method example

HQ ┬╗ Java Tutorial ┬╗ java.io ┬╗ BufferedReader ┬╗ reset() method example
Java BufferedReader reset() method example 2018-02-16T07:27:49+00:00

java.io.BufferedReader reset()

Description :

This java tutorial shows how to use the reset() method of BufferedReader class of java.io package. This method returns void and resets the stream to the latest mark. Make a note that if mark() method were not invoked prior to calling reset(), IOException will occur.

Method Syntax :

public void reset() throws IOException

Parameter Input :

DataType Parameter Description
N/A N/A N/A

Method Returns :

This method returns void.

Compatibility Version :

Requires Java 1.1 and up

Exception :

IOException

The IOException will be thrown by this method is I/O error occurs. The following cases will be considered as an IOException. if the marked character is invalidated or marked as invalid, and also if the stream is not marked at all.

Java Code Example :

This java example source code demonstrates the use of delimiter() method of Scanner class. Basically it prints the delimiter that is being used by the Scanner object scan which is the default pattern since we didn’t specify delimiter to be used. The code then tokenize the String declared on the constructor of the Scanner object.

Sample Output :

Running the reset() method example source code of BufferedReader class will give you the following output

Exception Scenario :

Similar Method :

  • N/A

Suggested Reading List :

References :

Contact Info

Singapore

Our Goal

JavaTutorialHQ aims to to be The Ultimate Guide on Java with hundreds of examples from basic to advance Topics.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close