title: What might cause an IOException in Java when I make a call to Reader.read()?
body: <p>I have code that looks something like:</p>
  
  <pre><code>public static void func(Reader r){
      int c = r.read();
      ...
  }
  </code></pre>
  
  <p>and the compiler tells me that <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/io/Reader.html#read%28%29" rel="nofollow"><code>r.read()</code></a> might throw an <code>IOException</code>. Under what circumstances might this happen? It seems clear that something like <code>FileNotFoundException</code> is thrown when a file is not found, but an <code>IOException</code> is rather vague.</p>
  
  <p>Edit:</p>
  
  <p>In case it is of interest to anyone, I asked this question because I thought there must be a better way of handling the situation than just <code>printStackTrace</code>. However, without knowing what might cause the exception, I wasn't really sure how it should be done.</p>