title: what is the use of mark read limit in bufferedinputstream
body: <p>I'm new to Java streams, I would like to read a specific files content then need to read it from the beginning. I have created a BufferedInputStream and i'm confused about the documentation of BufferedInputStream.mark(int markLimit) </p>
  
  <p>Documentation says:</p>
  
  <pre><code>public void mark(int readlimit)
  </code></pre>
  
  <blockquote>
    <p>This method marks a position in the input to which the stream can be "reset" by calling the reset() method. The parameter readlimit is the number of bytes that can be read from the stream after setting the mark before the mark becomes invalid. For example, if mark() is called with a read limit of 10, then when 11 bytes of data are read from the stream before the reset() method is called, then the mark is invalid and the stream object instance is not required to remember the mark.</p>
    
    <p>Note that the number of bytes that can be remembered by this method can be greater than the size of the internal read buffer. It is also not dependent on the subordinate stream supporting mark/reset functionality.</p>
    
    <p>Overrides:
    mark in class FilterInputStream</p>
    
    <p>Parameters:
    readlimit - The number of bytes that can be read before the mark becomes invalid**</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>public class Test {
      public static void main(String[] args) throws IOException {
  
          File resource = new File("beforeFix.txt");          
          FileInputStream fileInputStream = new FileInputStream(resource);
          BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
          int i = bufferedInputStream.read();
          bufferedInputStream.mark(1);
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          bufferedInputStream.reset(); 
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          i = bufferedInputStream.read();
          bufferedInputStream.reset();  
      }
  }
  </code></pre>
  
  <p>In the above code I have set the marklimit as 1 but the mark is not goes into invalid as per the documentation. </p>
  
  <p>Can anyone clearly explain me what is the actual purpose of setting this with small example?</p>
  
  <p>Thanks in advance</p>