prev prev
  Course navigation
    The stream classes
More-specific methods
Although InputStream and OutputStream are abstract classes, many methods in the class library are only specified to return an InputStream or OutputStream, not the more-specific subclass.
For example, this is the signature for the openStream() method in java.net.URL:
public final InputStream openStream()
 throws IOException
In most implementations of Java, this method actually returns a sun.net.TelnetInputStream object, which is a subclass of java.io.InputStream; but you can't use the methods of that class. Thus you'll often only be able to use the methods declared in these base classes.
  Course navigation