/** * Returns the height of the raster associated with the reader * * @return raster height */ public int getColumns() { synchronized ( LOCK ) { if ( width == -1 && !widthReadFailed && findReaderForIO() ) { try { width = reader.getWidth( imageIndex ); } catch ( IOException e ) { LOG.debug( "couldn't open image for width:" + e.getMessage(), e ); this.widthReadFailed = true; } resetStream(); } } return width; }
/** * Returns the height of the raster associated with the reader * * @return raster height */ public int getRows() { synchronized ( LOCK ) { if ( height == -1 && !heightReadFailed && findReaderForIO() ) { try { height = reader.getHeight( imageIndex ); } catch ( IOException e ) { LOG.debug( "couldn't open image for height:" + e.getMessage(), e ); this.heightReadFailed = true; } resetStream(); } } return height; }
/** * @return the raw metadata of the raster */ protected IIOMetadata getMetaData() { // md == null, // 1. didn't read the metadata // 2. the reader couldn't read it, just do not try again. // 3. synchronized ( LOCK ) { if ( metaData == null && !metadataReadFailed && findReaderForIO() ) { try { metaData = reader.getImageMetadata( 0 ); } catch ( IOException e ) { LOG.debug( "couldn't open metadata:" + e.getMessage(), e ); this.metadataReadFailed = true; } resetStream(); } } return metaData; }
/** * Reads data and returns a new RasterData object * * @return new RasterData */ @Override public ByteBufferRasterData read() { BufferedImage result = null; synchronized ( LOCK ) { if ( !imageReadFailed && findReaderForIO() ) { try { result = reader.read( imageIndex ); resetStream(); return RasterFactory.rasterDataFromImage( result, options ); } catch ( IOException e ) { LOG.error( "couldn't open image:" + e.getMessage(), e ); this.imageReadFailed = true; } } } return rasterDataFromImage( result, options ); }