title: Why cant a RandomAccessFile be casted to Inputstream?
body: <p>I get compilation error when I do this cast:</p>
  
  <pre><code>RandomAccessFile raf = new RandomAccessFile(...)
  InputStream is = (InputStream)raf;
  </code></pre>
  
  <p><code>RandomAccessFile</code> is supposed to subclass <code>InputStream</code> although not directly.</p>
  
  <p>From docs:</p>
  
  <p><code>RandomAccessFile</code> implements <code>DataInput</code> which inturn <code>DataInputstream</code> &amp; <code>InputStream</code></p>
  
  <p>Why is this invalid?</p>
  
  <p>Also appreciate your input on what would be the right way to use the <code>RandomAccessFile</code> as <code>InputStream</code>?</p>
  
  <p>I am thinking of wrapper approach.</p>