Class WebLocation


  • public class WebLocation
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.net.URI assertResolved()  
      java.awt.image.BufferedImage findRepresentingImage()
      Locate suitable representing image given URL.
      java.lang.String getDescription()
      Call after successful findRepresentingImage() call
      java.lang.String getFileName()  
      java.net.URL getImageUrl()
      Call after successful findRepresentingImage() call
      java.lang.String getTitle()
      Call after successful findRepresentingImage() call
      java.net.URI getURI()  
      java.net.URL getUrl()
      Deprecated.
      Use getURI instead in order to support relative paths in the future
      void print()  
      java.awt.image.BufferedImage readImage​(java.net.URL u)  
      static java.awt.image.BufferedImage readImage​(java.net.URL u, java.net.URL referrer)  
      void setURI​(java.net.URI uri)  
      void writeToFile​(java.io.File f)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebLocation

        public WebLocation​(java.net.URL url)
      • WebLocation

        public WebLocation​(java.net.URI uri)
      • WebLocation

        public WebLocation​(java.lang.String uri)
                    throws java.io.IOException,
                           java.net.URISyntaxException
        Throws:
        java.io.IOException
        java.net.URISyntaxException
      • WebLocation

        public WebLocation​(java.io.File webLocFile)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • assertResolved

        public java.net.URI assertResolved()
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • getUrl

        @Deprecated
        public java.net.URL getUrl()
                            throws java.net.MalformedURLException
        Deprecated.
        Use getURI instead in order to support relative paths in the future
        Returns:
        Throws:
        java.net.MalformedURLException
      • getURI

        public java.net.URI getURI()
      • setURI

        public void setURI​(java.net.URI uri)
      • getFileName

        public java.lang.String getFileName()
      • writeToFile

        public void writeToFile​(java.io.File f)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • print

        public void print()
      • readImage

        public java.awt.image.BufferedImage readImage​(java.net.URL u)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • readImage

        public static java.awt.image.BufferedImage readImage​(java.net.URL u,
                                                             java.net.URL referrer)
                                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • findRepresentingImage

        public java.awt.image.BufferedImage findRepresentingImage()
                                                           throws java.io.IOException
        Locate suitable representing image given URL. The representing image is resolved using the following steps: * First look for Facebook's og:image element * Second look for "folderthumb.jpg" (Turtle skin) * Then look for 1:st thumbnail image and locate corresponding image by replacing thumbs/ by slides/ * Then look for 1:st image pointed by album.rss feed *Finally return 1:st image larger than 120x120 or null Todo: Parse title and description too. * Finally
        Returns:
        Throws:
        java.io.IOException
      • getImageUrl

        public java.net.URL getImageUrl()
        Call after successful findRepresentingImage() call
        Returns:
      • getTitle

        public java.lang.String getTitle()
        Call after successful findRepresentingImage() call
        Returns:
      • getDescription

        public java.lang.String getDescription()
        Call after successful findRepresentingImage() call
        Returns: