@Override public boolean canLoad( File filename ) { String ext = FileUtils.getFileExtension( filename ); for ( String s : ASCRasterIOProvider.FORMATS ) { if ( s.equalsIgnoreCase( ext ) ) { return true; } } return false; }
@Override public boolean canLoad( File filename ) { return "xyz".equalsIgnoreCase( FileUtils.getFileExtension( filename ) ); }
@Override public boolean canLoad( File filename ) { return FILE_EXTENSION.equalsIgnoreCase( FileUtils.getFileExtension( filename ) ); }
@Override public boolean canLoad( File filename ) { return filename != null && GridRasterIOProvider.FORMATS.contains( FileUtils.getFileExtension( filename ).toLowerCase() ); }
@Override public boolean accept( File pathname ) { if ( !pathname.isDirectory() ) { String ext = FileUtils.getFileExtension( pathname ); String file = FileUtils.getFilename( pathname ); return ( file.startsWith( BLOB_FILE_NAME ) && BLOB_FILE_EXT.equalsIgnoreCase( "." + ext ) ); } return false; } } );
/** * Return a RasterIOOption object with the format set according to the given file. * * @param file * @return RasterIOOption proper format. */ public static RasterIOOptions forFile( File file ) { RasterIOOptions result = new RasterIOOptions(); String ext = FileUtils.getFileExtension( file ); result.add( OPT_FORMAT, ext ); return result; }
/** * Read the buildings from the given file. * * @param f * @param commandLine * @return the created d3 object representations. * @throws IOException */ protected List<WorldRenderableObject> readBuildingsFromFile( File f, CommandLine commandLine ) throws IOException { String extension = FileUtils.getFileExtension( f ); // int result = 0; List<WorldRenderableObject> buildings = null; if ( extension.equalsIgnoreCase( "SHP" ) ) { buildings = readShape( f.getAbsolutePath() ); } else if ( extension.equalsIgnoreCase( "XML" ) || extension.equalsIgnoreCase( "GML" ) ) { buildings = readGML( f.getAbsolutePath(), commandLine ); } else if ( extension.equalsIgnoreCase( "WRL" ) || extension.equalsIgnoreCase( "VRML" ) ) { // importer = new VRMLImporter( ); // result = buildings = readVRML( f.getAbsolutePath(), commandLine ); } return buildings; }
@Override public BackendResult importFromFile( File f, CommandLine commandLine ) throws IOException { if ( f == null || !f.exists() ) { throw new FileNotFoundException( "File may not be null, and must point to a valid csv file. " ); } CSVReader reader = new CSVReader( new FileReader( f ), ";", true ); if ( !"csv".equals( FileUtils.getFileExtension( f ) ) ) { LOG.info( "File extension of the tree file was not 'csv', trying to load anyway." ); } Map<Column, Integer> mappedColumns = mapColumns( reader.getColumnsNames() ); int maxLength = Column.values().length; for ( Integer i : mappedColumns.values() ) { maxLength = Math.max( maxLength, i ); } BackendResult result = readAndImportBillboards( reader, mappedColumns, maxLength ); LOG.info( "Number of referenced textures: " + usedTextures.size() ); StringBuilder sb = new StringBuilder( "Following textures were referenced:\n" ); for ( String s : usedTextures ) { sb.append( ( invalidTextures.contains( s ) ? "Not Found: " : "" ) ).append( s ).append( "\n" ); } LOG.info( sb.toString() ); return result; }
if ( !"csv".equals( FileUtils.getFileExtension( f ) ) ) { LOG.info( "File extension of the stage file was not 'csv', trying to load anyway." );
String ext = FileUtils.getFileExtension( testFile ); if ( ext == null ) { ext = outputFormat;
/** * Return a RasterIOOption object with the format set according to the given file with an optional * {@link RasterGeoReference}. * * @param file * @param envelope * @return RasterIOOption proper format. */ public static RasterIOOptions forFile( File file, RasterGeoReference envelope ) { RasterIOOptions result = new RasterIOOptions( envelope ); String ext = FileUtils.getFileExtension( file ); result.add( OPT_FORMAT, ext ); result.add( READ_WLD_FILE, null ); return result; }
File f = getRasterLocation( line ); if ( f.isFile() ) { inputType = FileUtils.getFileExtension( f ); } else { if ( inputType == null ) {
@Override public void write( AbstractRaster raster, File file, RasterIOOptions options ) throws IOException { LOG.debug( "writing " + file + " with JAI" ); String ext = FileUtils.getFileExtension( file ); String format = JAIRasterIOProvider.getJAIFormat( ext ); if ( format != null ) { JAIRasterDataWriter.saveRasterDataToFile( raster.getAsSimpleRaster().getRasterData(), file.getAbsolutePath(), format ); } else { JAIRasterDataWriter.saveRasterDataToFile( raster.getAsSimpleRaster().getRasterData(), file.getAbsolutePath() ); } RasterGeoReference rasterReference = raster.getRasterReference(); WorldFileAccess.writeWorldFile( rasterReference, file ); }
/** * Save a raster to a file. * * @param raster * @param filename * @param options * map with options for the raster writer * @throws IOException */ public static void saveRasterToFile( AbstractRaster raster, File filename, RasterIOOptions options ) throws IOException { RasterIOOptions opts = new RasterIOOptions(); opts.copyOf( options ); if ( !opts.contains( RasterIOOptions.OPT_FORMAT ) ) { String format = FileUtils.getFileExtension( filename ); opts.add( RasterIOOptions.OPT_FORMAT, format ); } RasterWriter writer = getRasterWriter( raster, opts ); if ( writer == null ) { log.error( "couldn't find raster writer for " + filename ); throw new IOException( "couldn't find raster writer" ); } writer.write( raster, filename, options ); }
@Override public void write( AbstractRaster raster, File file, RasterIOOptions options ) throws IOException { LOG.debug( "writing " + file + " with ImageIO" ); String format = options != null ? options.get( RasterIOOptions.OPT_FORMAT ) : null; if ( format == null ) { format = FileUtils.getFileExtension( file ); } LOG.debug( "Writing raster with width: {} height: {}", raster.getColumns(), raster.getRows() ); if ( "geotiff".equals( format ) ) { GeoTiffWriter.save( raster, file ); } else { IIORasterDataWriter.saveRasterDataToFile( raster.getAsSimpleRaster().getRasterData(), file, format ); RasterGeoReference rasterReference = raster.getRasterReference(); WorldFileAccess.writeWorldFile( rasterReference, file ); } }