/** * Gets the random access handle for the given id. * * @param id the mapped name * @return the corresponding IRandomAccess, or null if there is no mapping * @see #mapFile(String, IRandomAccess) */ public static IRandomAccess getMappedFile(String id) { if (getIdMap() == null) return null; IRandomAccess ira = null; if (id != null && (getIdMap().get(id) instanceof IRandomAccess)) { ira = (IRandomAccess) getIdMap().get(id); } return ira; }
/** * Gets the actual filename on disk for the given id. Typically the id itself * is the filename, but in some cases may not be; e.g., if OMEIS has renamed * a file from its original name to a standard location such as Files/101, * the original filename is useful for checking the file extension and doing * pattern matching, but the renamed filename is required to read its * contents. * @see #mapId(String, String) */ public static String getMappedId(String id) { if (getIdMap() == null) return id; String filename = null; if (id != null && (getIdMap().get(id) instanceof String)) { filename = (String) getIdMap().get(id); } return filename == null ? id : filename; }
/** * Clear all caches and reset cache-related bookkeeping variables to their * original values. */ public static void reset() { cacheListings = false; cacheNanos = 60L * 60L * 1000L * 1000L * 1000L; fileListings.clear(); getIdMap().clear(); }
/** * Gets the actual filename on disk for the given id. Typically the id itself * is the filename, but in some cases may not be; e.g., if OMEIS has renamed * a file from its original name to a standard location such as Files/101, * the original filename is useful for checking the file extension and doing * pattern matching, but the renamed filename is required to read its * contents. * * @param id the mapped name * @return the corresponding file name on disk, or null if there is no mapping * @see #mapId(String, String) */ public static String getMappedId(String id) { if (getIdMap() == null) return id; String filename = null; if (id != null && (getIdMap().get(id) instanceof String)) { filename = (String) getIdMap().get(id); } return filename == null ? id : filename; }
/** * Clear all caches and reset cache-related bookkeeping variables to their * original values. */ public static void reset() { cacheListings = false; cacheNanos = 60L * 60L * 1000L * 1000L * 1000L; fileListings.clear(); getIdMap().clear(); }
/** * Maps the given id to the given IRandomAccess object. * * @param id the mapped name * @param ira the IRandomAccess object that will be referenced by * <code>id</code>. If null, any existing mapping for * <code>id</code> will be cleared. * @see #getMappedFile(String) */ public static void mapFile(String id, IRandomAccess ira) { if (id == null) return; if (ira == null) getIdMap().remove(id); else getIdMap().put(id, ira); LOGGER.debug("Location.mapFile: {} -> {}", id, ira); }
/** * Maps the given id to an actual filename on disk. Typically actual * filenames are used for ids, making this step unnecessary, but in some * cases it is useful; e.g., if the file has been renamed to conform to a * standard naming scheme and the original file extension is lost, then * using the original filename as the id assists format handlers with type * identification and pattern matching, and the id can be mapped to the * actual filename for reading the file's contents. * @see #getMappedId(String) */ public static void mapId(String id, String filename) { if (id == null) return; if (filename == null) getIdMap().remove(id); else getIdMap().put(id, filename); LOGGER.debug("Location.mapId: {} -> {}", id, filename); }
/** * Maps the given id to an actual filename on disk. Typically actual * filenames are used for ids, making this step unnecessary, but in some * cases it is useful; e.g., if the file has been renamed to conform to a * standard naming scheme and the original file extension is lost, then * using the original filename as the id assists format handlers with type * identification and pattern matching, and the id can be mapped to the * actual filename for reading the file's contents. * * @param id the mapped name * @param filename the actual filename on disk. * If null, any existing mapping for <code>id</code> will be cleared. * @see #getMappedId(String) */ public static void mapId(String id, String filename) { if (id == null) return; if (filename == null) getIdMap().remove(id); else getIdMap().put(id, filename); LOGGER.debug("Location.mapId: {} -> {}", id, filename); }
private String[] getTIFFList() { File dirFile = new File(currentId).getAbsoluteFile(); String[] listing = null; if (dirFile.exists()) { listing = dirFile.getParentFile().list(); } else { listing = Location.getIdMap().keySet().toArray(new String[0]); } Arrays.sort(listing); final List<String> list = new ArrayList<String>(); for (int k=0; k<listing.length; k++) { if (checkSuffix(listing[k], TiffReader.TIFF_SUFFIXES)) { list.add(listing[k]); } } return list.toArray(new String[list.size()]); }
private String[] getTIFFList() { File dirFile = new File(currentId).getAbsoluteFile(); String[] listing = null; if (dirFile.exists()) { listing = dirFile.getParentFile().list(); } else { listing = Location.getIdMap().keySet().toArray(new String[0]); } Arrays.sort(listing); final List<String> list = new ArrayList<String>(); for (int k=0; k<listing.length; k++) { if (checkSuffix(listing[k], TiffReader.TIFF_SUFFIXES)) { list.add(listing[k]); } } return list.toArray(new String[list.size()]); }
@AfterClass public void close() throws IOException { reader.close(); HashMap<String, Object> idMap = Location.getIdMap(); idMap.clear(); Location.setIdMap(idMap); }
files = Location.getIdMap().keySet().toArray(new String[0]); if (files.length == 0) { dir = ".";
files = Location.getIdMap().keySet().toArray(new String[0]); if (files.length == 0) { dir = ".";
if (!patternIds) { HashMap<String, Object> map = Location.getIdMap(); if (map.containsKey(id)) {
if (!patternIds) { HashMap<String, Object> map = Location.getIdMap(); if (map.containsKey(id)) {
boolean reallyInMemory = false; if (inMemory && reader.isSingleFile(id)) { HashMap<String, Object> idMap = Location.getIdMap(); idMap.clear(); Location.setIdMap(idMap);
String[] ls = workingDir.list(true); if (!new Location(id).exists()) { ls = Location.getIdMap().keySet().toArray(new String[0]); workingDirPath = "";
String[] ls = workingDir.list(true); if (!new Location(id).exists()) { ls = Location.getIdMap().keySet().toArray(new String[0]); workingDirPath = "";