title: How to "reset" or "clear" System.in using java application?
body: <p>I was running a java application roughly like the one below:</p>
  
  <pre><code>InputStreamReader isReader = new InputStreamReader(System.in);
  BufferedReader bufReader = new BufferedReader(isReader);
  while (true) {
      try {
          String inputStr = null;
          if ((inputStr=bufReader.readLine()) != null) {
              //DO SOMETHING
          }
          else {
              System.out.println("input is null");
          }
      }
      catch (Exception e) {
          //DO SOMETHING
      }
  }
  </code></pre>
  
  <p>using this command <code>java test &lt; textfilename</code>
  but after all the things are read in, the application starts to keep printing <code>input is null</code>. Of course I can add <code>break;</code> below <code>System.out.println("input is null");</code>, but does there exist a way that can clears the input buffer and starts to get input from command line?</p>
  
  <p>PS: An example of a file I am using:</p>
  
  <pre><code>11111111
  11111112
  11111113
  11111114
  </code></pre>