private void readWorldFiles(Object source, AVList params) throws java.io.IOException { if (!(source instanceof java.io.File)) { String message = Logging.getMessage("DataRaster.CannotRead", source); Logging.logger().severe(message); throw new java.io.IOException(message); } java.io.File[] worldFiles = WorldFile.getWorldFiles((java.io.File) source); WorldFile.decodeWorldFiles(worldFiles, params); // Translate the property WORLD_FILE_IMAGE_SIZE to separate properties WIDTH and HEIGHT. Object o = params.getValue(WorldFile.WORLD_FILE_IMAGE_SIZE); if (o != null && o instanceof int[]) { int[] size = (int[]) o; params.setValue(AVKey.WIDTH, size[0]); params.setValue(AVKey.HEIGHT, size[1]); } }
private boolean canReadWorldFiles(Object source) { if (!(source instanceof java.io.File)) return false; try { java.io.File[] worldFiles = WorldFile.getWorldFiles((java.io.File) source); if (worldFiles == null || worldFiles.length == 0) return false; } catch (java.io.IOException e) { // Not interested in logging the exception, we only want to report the failure to read. return false; } return true; }