MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / readZipContents

Method readZipContents

src/javajs/async/Assets.java:575–592  ·  view source on GitHub ↗
(InputStream is, URL url)

Source from the content-addressed store, hash-verified

573 }
574
575 private Map<String, ZipEntry> readZipContents(InputStream is, URL url) throws IOException {
576 HashMap<String, ZipEntry> fileNames = new HashMap<String, ZipEntry>();
577 if (doCacheZipContents)
578 htZipContents.put(url.toString(), fileNames);
579 ZipInputStream input = new ZipInputStream(is);
580 ZipEntry zipEntry = null;
581 int n = 0;
582 while ((zipEntry = input.getNextEntry()) != null) {
583 if (zipEntry.isDirectory() || zipEntry.getSize() == 0)
584 continue;
585 n++;
586 String fileName = zipEntry.getName();
587 fileNames.put(fileName, zipEntry); // Java has no use for the ZipEntry, but JavaScript can read it.
588 }
589 input.close();
590 System.out.println("Assets: " + n + " zip entries found in " + url); //$NON-NLS-1$
591 return fileNames;
592 }
593
594 private void resort() {
595 sortedList = new String[assetsByPath.size()];

Callers 1

_getZipContentsMethod · 0.95

Calls 6

getSizeMethod · 0.65
getNameMethod · 0.65
closeMethod · 0.65
printlnMethod · 0.65
putMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected