title: how to reopen and interrupt keyboard stream?
body: <p>I have a very simple question.<br/>
  Based on Java I/O scheme, whenever a thread is waiting for some data, so it will be blocked? is it true? something like this.</p>
  
  <pre><code>byte[] _buff=new byte[1024];
  int _r=_in.read(_buff);//it blocks until some data is available
  </code></pre>
  
  <p>and the just possible way to give up reading is closing the stream by another thread, is it right? something like this.</p>
  
  <pre><code>void run(){
  _in.close();
  }
  </code></pre>
  
  <p>so if I am right with above scenarios, so why this is impossible just interrupt a thread which is reading from <code>System.in</code> by closing the stream. I run a thread that just waits for 5 seconds then wants to interrupt/give up rest of the reading from the stream.</p>
  
  <pre><code>void _read_data(){
    System.out.print("enter y to save the workspace ");
    new Thread(_cancel_thread).start();
    int _r=System.in.read();//blocks
  }
  ///////////
  void run(){
    try{
     Thread.sleep(5000);
     System.in.close();//doesn't work.
    }catch(Exception _ex){}
  }
  </code></pre>
  
  <p><strong>Questions:</strong><br/>
  1.How to close the stream?! why the closing stream thread cannot close the stream?!<br/>
  2.Once the stream got closed, how to open it again?!</p>