/** * @param reader * to a world file. * @param options * set for this stream. * @return a RasterReference * @throws IOException */ public static RasterGeoReference readWorldFile( Reader reader, RasterIOOptions options ) throws IOException { if ( reader == null ) { throw new IOException( "Reader is null, no world file found." ); } BufferedReader br = ( reader instanceof BufferedReader ) ? (BufferedReader) reader : new BufferedReader( reader ); return readRasterReference( br, "from reader", options ); }
/** * @param stream * the stream pointing to a world file. * @param options * set for this stream. * @return a RasterReference * @throws IOException */ public static RasterGeoReference readWorldFile( InputStream stream, RasterIOOptions options ) throws IOException { if ( stream == null ) { throw new IOException( "Stream is null, no world file found." ); } BufferedReader br = new BufferedReader( new InputStreamReader( stream ) ); return readRasterReference( br, "from stream", options ); }
/** * @param filename * the image/raster file (including path and file extension) * @param options * set for this file. * @return a RasterReference * @throws IOException */ public static RasterGeoReference readWorldFile( File filename, RasterIOOptions options ) throws IOException { File worldFile = getWorldFile( filename ); if ( !worldFile.exists() ) { throw new IOException( "No world file for: " + filename ); } if ( log.isDebugEnabled() ) { log.debug( "read worldfile for " + filename ); } BufferedReader br = new BufferedReader( new FileReader( worldFile ) ); RasterGeoReference result = readRasterReference( br, worldFile.getAbsolutePath(), options ); br.close(); return result; }