Latest News

 










Getting data from a URL

Previous slide Next slide Back to first slide View graphic version


Getting data from a URL


 
My other sites

Latest News

 










Getting data from a URL

    There are three methods in the URL class for retrieving data from a URL :


  • public final InputStream openStream()

    • returns a stream to the data.
  • public URLConnection openConnection()

    • is used to communicate directly with the server. It gives access to the raw data.
  • public final Object getContent()

    • tries to parse the data into an Object representing the data based on the returned MIME-type. A content-handler for each type must exists but in JDK only a few are available: text/plain, text/generic, image/gif and image/jpeg.

Previous slide Next slide Back to first slide View graphic version