static ZipResourcePyramidSource getZipSource (String rootpath, String extension) { Pair<String, String> key = new Pair<>(rootpath, extension); if (!_zipfileCache.containsKey(key)) { synchronized (_zipfileCache) { if (!_zipfileCache.containsKey(key)) { if (rootpath.startsWith("file://")) { rootpath = rootpath.substring(7); } else if (rootpath.startsWith("res://")) { rootpath = rootpath.substring(6); URL zipFile = PyramidIOFactory.class.getResource(rootpath); rootpath = zipFile.getFile(); } ZipResourcePyramidSource source = new ZipResourcePyramidSource(rootpath, extension); _zipfileCache.put(key, source); } } } return _zipfileCache.get(key); }
ZipResourcePyramidSource src = new ZipResourcePyramidSource(filename, "dummy"); InputStream is = src.getSourceTileStream("test", tileDef); Assert.assertTrue(is!=null); is = src.getSourceTileStream("test", tileDef); Assert.assertTrue(is!=null); is = src.getSourceMetaDataStream("test"); Assert.assertTrue(is!=null);
source = ZipResourcePyramidSource.getZipSource(rootpath, extension); } else if (rootpath.startsWith("file://")) {
private void updatePyramid () { FileBasedPyramidIO oldIO = _io; if (null != _zipPath && null != _extension) { PyramidSource newSource = new ZipResourcePyramidSource(_zipPath, _extension); _io = new FileBasedPyramidIO(newSource); firePropertyChange(BinVisualizer.PYRAMID_IO, oldIO, _io); } else if (null != oldIO) { _io = null; firePropertyChange(BinVisualizer.PYRAMID_IO, oldIO, _io); } }