The mark() method is a built-in method of the Java.io.ByteArrayInputStream marks the current position of the input stream. It sets readlimit i.e. maximum number of bytes that can be read before mark position becomes invalid.
public void mark(int arg)
Parameters: The function accepts a single mandatory parameter arg which specifies the maximum limit of bytes that can be read before the mark position becomes invalid.
Return Value: The function returns nothing.
Below is the implementation of the above function:
5 6 7 Mark() invocation 8 9
1 Mark() invocation 2 3
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.