Class ImageScraper.Results

  • Enclosing class:
    ImageScraper

    public static class ImageScraper.Results
    extends java.lang.Object
    ImageScraper Results - Documentation.

    When a download request has completed, this Object will be instantiated and returned. Quite a bit of energy was spent ensuring that this class does not freeze nor fail when a particular image fails to download. This is a customizable setting (boolean value to the constructor), so if the programmer would prefer download execution to halt immediately, if a single-image in the list fails-download, there is a setting for this in the ImageScraper constructor.

    IMPORTANT: Many of the values in the arrays for this 'Results' class will contain null-values, or '-1' in the case of the width, height & size integer-array's - in the case that a particular image failed to download. There is an easy way to check which URL's failed, and which succeeded, as should hopefully be obvious in the names of the member fields of this class. Member field 'skipped' which is a boolean[] array will indicate whether a particular image among the list of images passed to the ImageScraper constructor succeeded or failed.



    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        The java serializable tools can be very beneficial for saving the state of a program you are testing. Though it is unlikely a programmer would want to transmit this 'results-report' class around (or at least I cannot think of much use), saving the state of web-page scrape and all the testing routines that have been used is something that can be really helpful. This is why most of the classes that can be created / instantiated - a.k.a. non-static classes - implement the Serializable interface. It's a great debugging tool.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
        1
        public static final long serialVersionUID = 1;
        
      • urls

        public final java.net.URL[] urls
        This will contain a complete list of the URL's that were retrieved (or generated- if partially-resolved 'relative' URL's occurred). Every image downloaded (or attempted for download) will have its URL saved here.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final URL[] urls;
        
      • skipped

        public final boolean[] skipped
        If the "skip" Predicate declares that a particular image-download should not be attempted, FALSE will be stored in this array.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final boolean[] skipped;
        
      • fileNames

        public final java.lang.String[] fileNames
        The names of the files that were retrieved and/or stored will be in this array. If this image were skipped or an exception occurred, the array position for that URL would contain 'null'.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final String[] fileNames;
        
      • saveDirectories

        public final java.lang.String[] saveDirectories
        The location of the file-name saved directory, if an image did not successfully save to the file system, or if an ImageReceiver were used, then the array-location would contain 'null.'

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final String[] saveDirectories;
        
      • imageFormats

        public final IF[] imageFormats
        The image type of the files that were retrieved will be stored in this array.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final IF[] imageFormats;
        
      • exceptions

        public final java.lang.Exception[] exceptions
        If an image download fails, this will contain a record of the exception.

        The index of this array will be parallel to the input-source URL retrieval order.

        If the download succeeded, then the associated array location would contain 'null.'
        Code:
        Exact Field Declaration Expression:
        1
        public final Exception[] exceptions;
        
      • sizes

        public final long[] sizes
        This will contain a list of long-integers, each of which will have the file-size of the downloaded image. If the programmer has elected for the 'ImageReceiver' option - rather than direct download of the images to the underlying file-system (save to lambda, instead of save-as-file) - then the "fileSize" will be a calculated file-size, and not reflect the actual size of any file on the file-system. Obviously, this is because no file was created!

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final long[] sizes;
        
      • widths

        public final int[] widths
        This will contain a list of integers, each of which shall have the image-widths of the downloaded images.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final int[] widths;
        
      • heights

        public final int[] heights
        This shall contain a list of integers, each of which shall have the image-heights of the downloaded images.

        The index of this array will be parallel to the input-source URL retrieval order.
        Code:
        Exact Field Declaration Expression:
        1
        public final int[] heights;