Class ICSDownloader

java.lang.Object
com.nicholasalfonso.lato.integration.ICSDownloader

@Component public class ICSDownloader extends Object
HTTP client utility for downloading and validating remote iCalendar feeds.
  • Constructor Details

    • ICSDownloader

      public ICSDownloader()
  • Method Details

    • downloadFeed

      public InputStream downloadFeed(String url) throws IOException, InterruptedException
      Downloads an iCalendar feed as an input stream.
      Parameters:
      url - the feed URL to download
      Returns:
      input stream containing the feed body
      Throws:
      IOException - if the HTTP request fails
      InterruptedException - if the HTTP request is interrupted
    • validateUrl

      public boolean validateUrl(String url)
      Validates that a URL points to a reachable iCalendar feed.
      Parameters:
      url - the feed URL to validate
      Returns:
      true if the URL is valid and returns iCalendar content
    • downloadFeedAsString

      public String downloadFeedAsString(String url) throws IOException, InterruptedException
      Downloads an iCalendar feed and returns its content as a string.
      Parameters:
      url - the feed URL to download
      Returns:
      the feed body as a string
      Throws:
      IOException - if the HTTP request fails
      InterruptedException - if the HTTP request is interrupted