Class SvgDownloader

  • All Implemented Interfaces:

    
    public final class SvgDownloader
    
                        

    Downloads icon SVG files from CDN with local caching, validation, and retry logic.

    Supports multiple icon libraries through the IconConfig interface.

    Features:

    • Content validation (type, size, structure)

    • 7-day cache with metadata tracking

    • HTTPS enforcement for security

    • Automatic retry with exponential backoff

    • Method Detail

      • downloadSvg

         final String downloadSvg(String iconName, IconConfig config)

        Download an SVG file for the given icon and configuration with automatic retry logic.

        This method:

        • Checks the local cache first

        • Downloads from CDN if not cached (with retries on failure)

        • Validates content type, size, and structure

        • Caches valid content for future use

        Retry Strategy:

        • Exponential backoff: delay doubles after each retry

        • Configurable max retries (default: 3)

        • Configurable initial delay (default: 1000ms)

        Parameters:
        iconName - Name of the icon
        config - Icon library configuration
        Returns:

        SVG content as string, or null if download fails after all retries