/** * Reads the index file, 'gridded_raster.info' from the given directory reads the world file information as well as * the number of tiles. * * @param dir * to read the gridded_raster.info * @param options * which will hold information on the file. * @return a {@link GriddedBlobTileContainer} instantiated with the values read from the gridded_raster.info. * @throws IOException */ public static GriddedBlobTileContainer create( File dir, RasterIOOptions options ) throws IOException { File metaInfoFile = new File( dir, METAINFO_FILE_NAME ); if ( !metaInfoFile.exists() ) { throw new IOException( "Could not find the " + METAINFO_FILE_NAME + " in the given directory, " + dir ); } GridMetaInfoFile readFromFile = GridMetaInfoFile.readFromFile( metaInfoFile, options ); return new GriddedBlobTileContainer( readFromFile, dir ); }
/** * @param options * @throws IOException * @throws NumberFormatException */ private synchronized void instantiate( File gridFile, RasterIOOptions options ) throws NumberFormatException, IOException { if ( infoFile == null && gridFile != null ) { this.dataLocationId = options == null ? FileUtils.getFilename( gridFile ) : options.get( RasterIOOptions.ORIGIN_OF_RASTER ); File metaInfo = GridMetaInfoFile.fileNameFromOptions( gridFile.getParent(), FileUtils.getFilename( gridFile ), options ); this.instantiate( GridMetaInfoFile.readFromFile( metaInfo, options ), gridFile ); } }