private void readRawDataTile(int tileX, int tileY, WritableRaster targetRaster) throws IOException { final ImageInputStream imageInputStream = inputStreamFactory.createImageInputStream(tileX, tileY); try { readRawDataTile(imageInputStream, targetRaster); } finally { imageInputStream.close(); } }
/** * Computes a tile. Since the operation has no sources, * there is no need to worry about cobbling. * <p/> * <p> Subclasses should implement the * <code>computeRect(PlanarImage[], WritableRaster, Rectangle)</code> * method to perform the actual computation. * * @param tileX The X index of the tile. * @param tileY The Y index of the tile. */ @Override public Raster computeTile(int tileX, int tileY) { // System.out.println("TiledFileOpImage.computeTile: >> '" + getTileFilename(tileX, tileY) + "'..."); final Point location = new Point(tileXToX(tileX), tileYToY(tileY)); final Raster raster; if (imageHeader.getTileFormat().startsWith("raw")) { final WritableRaster targetRaster = createWritableRaster(sampleModel, location); try { readRawDataTile(tileX, tileY, targetRaster); } catch (IOException e) { throw new RuntimeException("Failed to read image tile.", e); } raster = targetRaster; } else { raster = readImageTile(tileX, tileY, location); } // System.out.println("TiledFileOpImage.computeTile: << '" + getTileFilename(tileX, tileY) + "'"); return raster; }