PushbackReader reset() method in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The reset() method of PushbackReader Class in Java is used to reset the Stream. In the case of PushbackReader, this method always throws an exception as this method isn't supported by the PushbackReader. Syntax: public void reset() Parameters: This method do not accepts any parameter. Return Value: This method do not returns any value. Exception: This method throws IOException always as the reset() method is not supported. Below methods illustrates the working of reset() method: Program 1: Java // Java program to demonstrate // PushbackReader reset() method import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { try { // Initializing a StringReader // and PushbackReader String s = "GeeksForGeeks"; StringReader stringReader = new StringReader(s); PushbackReader pushbackReader = new PushbackReader(stringReader); // reset the stream position pushbackReader.reset(); // Close the stream using reset() pushbackReader.close(); System.out.println("Stream Closed."); } catch (Exception e) { System.out.println(e); } } } Output: java.io.IOException: mark/reset not supported Program 2: Java // Java program to demonstrate // PushbackReader reset() method import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { try { // Initializing a StringReader // and PushbackReader String s = "GFG"; StringReader stringReader = new StringReader(s); PushbackReader pushbackReader = new PushbackReader(stringReader); // reset the stream position pushbackReader.reset(); // Close the stream pushbackReader.close(); System.out.println("Stream Closed."); } catch (Exception e) { System.out.println(e); } } } Output: java.io.IOException: mark/reset not supported Reference: https://docs.oracle.com/javase/9/docs/api/java/io/PushbackReader.html#reset-- Comment More infoAdvertise with us Next Article PushbackReader unread() method in Java with Examples S srinam Follow Improve Article Tags : Java Java-Functions Java-IO package Java-PushbackReader Practice Tags : Java Similar Reads PushbackReader read() method in Java with Examples The read() method of PushbackReader Class in Java is used to read a single character from the stream. This method blocks the stream till: It has taken some input from the stream. Some IOException has occurred It has reached the end of the stream while reading. Syntax: public int read() Parameters: T 3 min read PushbackReader ready() method in Java with Examples The ready() method of PushbackReader Class in Java is used to check whether this PushbackReader is ready to be read or not. It returns a boolean which states if the reader is ready. Syntax: public void ready() Parameters: This method does not accepts any parameters Return Value: This method returns 2 min read PushbackReader unread() method in Java with Examples The unread() method of PushbackReader class in Java is of three types: The unread(int c) method of PushbackReader class in Java is used to push back a character by copying it to the front of the pushback buffer. After revoking this method, when the next character is read it has the value equal to th 5 min read Reader reset() method in Java with Examples The reset() method of Reader Class in Java is used to reset the stream. After reset, if the stream has been marked, then this method attempts to reposition it at the mark, else it will try to position it to the starting. Syntax: public void reset() Parameters: This method do not accepts any paramete 3 min read PushbackInputStream reset() method in Java with Examples The reset() method of PushbackInputStream class in Java is used to reset the steam to the position where mark() method was called. This method does nothing for PushbackInputStream. Syntax: public void reset() throws IOException Overrides: This method overrides the reset() method of FilterInputStream 2 min read PushbackReader close() method in Java with Examples The close() method of PushbackReader Class in Java is used to close the stream and release the resources that were busy in the stream, if any. This method has following results: If the stream is open, it closes the stream releasing the resources If the stream is already closed, it will have no effec 2 min read Like