private static File[] mapFileType( File entityFile ) { String filepath = FileUtils.getBasename( entityFile ); File data = new File( filepath + ".bin" ); File idx = new File( filepath + ".idx" ); File info = new File( filepath + ".info" ); return new File[] { idx, data, info }; }
/** * Returns the world file for given file. * * @param rasterFile * the raster file * @return the world file or null if not found. */ private static File getWorldFile( File rasterFile ) { String basename = FileUtils.getBasename( rasterFile ); // Look for corresponding worldfiles. String wldName = ""; for ( String ext : WORLD_FILE_EXT ) { String tmp = basename + "." + ext; if ( new File( tmp ).exists() ) { wldName = tmp; break; } } return new File( wldName ); }
/** * writes a RasterReference into a world file. * * @param renv * the envelope * @param file * the raster file * @param extension * the file extension for the world file (eg. 'wld', 'tfw', etc) * @throws IOException */ public static void writeWorldFile( RasterGeoReference renv, File file, String extension ) throws IOException { File f = new File( FileUtils.getBasename( file ) + "." + extension ); FileWriter fw = new FileWriter( f ); PrintWriter pw = new PrintWriter( fw ); writeWorldFile( renv, pw ); pw.close(); fw.close(); }