The markSupported() method of BufferedInputStream class in Java is used to verify whether the input stream supports the mark and reset method or not. If any of the two methods is not supported by the input stream then the program will return false else true.
public boolean markSupported()
Parameters: This method does not accept any parameter.
Return value: This method returns a boolean indicating the supportability the mark and reset methods.
Overrides: The method is overridden by the markSupported in FilterInputStream class.
Exception: This method does not throw any exception.
Below programs illustrate markSupported() method in BufferedInputStream class in IO package:
Program 1: Assume the existence of file “c:/demo.txt”.
Support for mark() and reset() : true
Program 2: Assume the existence of file “c:/demo.txt”.
Support for mark() and reset() : false
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.