Class ResourcesLoader

java.lang.Object
nl.siegmann.epublib.epub.ResourcesLoader

public class ResourcesLoader extends Object
Loads Resources from inputStreams, ZipFiles, etc
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

    • ResourcesLoader

      public ResourcesLoader()
  • Method Details

    • loadResources

      public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException
      Loads the entries of the zipFile as resources. The MediaTypes that are in the lazyLoadedTypes will not get their contents loaded, but are stored as references to entries into the ZipFile and are loaded on demand by the Resource system.
      Parameters:
      zipFile -
      defaultHtmlEncoding -
      lazyLoadedTypes -
      Returns:
      Throws:
      IOException
    • shouldLoadLazy

      private static boolean shouldLoadLazy(String href, Collection<MediaType> lazilyLoadedMediaTypes)
      Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.
      Parameters:
      href -
      lazilyLoadedMediaTypes -
      Returns:
      Whether the given href will load a mediaType that is in the collection of lazilyLoadedMediaTypes.
    • loadResources

      public static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding) throws IOException
      Loads all entries from the ZipInputStream as Resources. Loads the contents of all ZipEntries into memory. Is fast, but may lead to memory problems when reading large books on devices with small amounts of memory.
      Parameters:
      zipInputStream -
      defaultHtmlEncoding -
      Returns:
      Throws:
      IOException
    • getNextZipEntry

      private static ZipEntry getNextZipEntry(ZipInputStream zipInputStream) throws IOException
      Throws:
      IOException
    • loadResources

      public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding) throws IOException
      Loads all entries from the ZipInputStream as Resources. Loads the contents of all ZipEntries into memory. Is fast, but may lead to memory problems when reading large books on devices with small amounts of memory.
      Parameters:
      zipFile -
      defaultHtmlEncoding -
      Returns:
      Throws:
      IOException