@Test public void testLoadResources_ZipFile() throws IOException { ZipFile zipFile = new ZipFile(testBookFilename); Resources resources = ResourcesLoader.loadResources(zipFile, encoding); verifyResources(resources); }
public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException { Resources result = new Resources(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement(); if(zipEntry == null || zipEntry.isDirectory()) { continue; } String href = zipEntry.getName(); Resource resource; if (shouldLoadLazy(href, lazyLoadedTypes)) { resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href); } else { resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry)); } if(resource.getMediaType() == MediatypeService.XHTML) { resource.setInputEncoding(defaultHtmlEncoding); } result.add(resource); } return result; }
ResourcesLoader { public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException { Resources result = new Resources(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement(); if(zipEntry == null || zipEntry.isDirectory()) { continue; } String href = zipEntry.getName(); Resource resource; if (shouldLoadLazy(href, lazyLoadedTypes)) { resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href); } else { resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry)); } if(resource.getMediaType() == MediatypeService.XHTML) { resource.setInputEncoding(defaultHtmlEncoding); } result.add(resource); } return result; } }
ResourcesLoader { public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException { Resources result = new Resources(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement(); if(zipEntry == null || zipEntry.isDirectory()) { continue; } String href = zipEntry.getName(); Resource resource; if (shouldLoadLazy(href, lazyLoadedTypes)) { resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href); } else { resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry)); } if(resource.getMediaType() == MediatypeService.XHTML) { resource.setInputEncoding(defaultHtmlEncoding); } result.add(resource); } return result; }  }
ResourcesLoader { public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException { Resources result = new Resources(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement(); if(zipEntry == null || zipEntry.isDirectory()) { continue; } String href = zipEntry.getName(); Resource resource; if (shouldLoadLazy(href, lazyLoadedTypes)) { resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href); } else { resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry)); } if(resource.getMediaType() == MediatypeService.XHTML) { resource.setInputEncoding(defaultHtmlEncoding); } result.add(resource); } return result; }  static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding,
			List<MediaType> lazyLoadedTypes); static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding); static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding); }
ResourcesLoader { public static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding, List<MediaType> lazyLoadedTypes) throws IOException { Resources result = new Resources(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while( entries.hasMoreElements() ) { ZipEntry zipEntry = entries.nextElement(); if(zipEntry == null || zipEntry.isDirectory()) { continue; } String href = zipEntry.getName(); Resource resource; if (shouldLoadLazy(href, lazyLoadedTypes)) { resource = new LazyResource(zipFile.getName(), zipEntry.getSize(), href); } else { resource = ResourceUtil.createResource(zipEntry, zipFile.getInputStream(zipEntry)); } if(resource.getMediaType() == MediatypeService.XHTML) { resource.setInputEncoding(defaultHtmlEncoding); } result.add(resource); } return result; }  static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding,
			List<MediaType> lazyLoadedTypes); static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding); static Resources loadResources(ZipFile zipFile, String defaultHtmlEncoding);  }