Why cant a RandomAccessFile be casted to Inputstream?
I get compilation error when I do this cast: RandomAccessFile raf = new RandomAccessFile(...) InputStream is = (InputStream)raf; RandomAccessFile is supposed to subclass InputStream although not directly. From docs: RandomAccessFile implements DataInput which inturn DataInputstream & InputStream Why is this invalid? Also appreciate your input on what would be the right way to use the RandomAccessFile as InputStream ? I am thinking of wrapper approach. RandomAccessFile extends Object , and does not extend InputStream . If you want get an InputStream from a RandomAccessFile I think implementing