InputStream provides a general mechanism for accessing a resource regardless of the nature of the resource, but isn't convenient for passing to methods or storing within objects. In contrast, specific types of resources have representations that can conveniently be passed around and stored (e.g. File, URL, byte[]) but commit the code to one specific type of resource. One way to get the best of both worlds is to define a "ReadableResource" interface to represent any resource from which an InputStream can be obtained, together with suitable implementation classes for each type of resource. The same approach is also applicable for writable resources and their OutputStreams.