/** * Returns a {@link RasterLayerResponse} from the specified {@link RasterLayerRequest}. * * @param request a previously set {@link RasterLayerRequest} defining a set of parameters to get * a specific coverage * @return the computed {@code RasterLayerResponse} * @todo Future versions may cache requestes<->responses using hashing */ private RasterLayerResponse requestCoverage(RasterLayerRequest request) { final RasterLayerResponse response = new RasterLayerResponse(request, coverageFactory, readerSPI); try { response.compute(); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); return null; } return response; }
/** * Returns a {@link GridCoverage} from this reader in compliance with the specified parameters. * * @param params a {@code GeneralParameterValue} array to customize the read operation. */ public GridCoverage2D read(GeneralParameterValue[] params) throws IllegalArgumentException, IOException { // Setup a new coverage request final RasterLayerRequest request = new RasterLayerRequest(params, this); // compute the request. final RasterLayerResponse response = requestCoverage(request); if (response != null) return (GridCoverage2D) response.getGridCoverage(); return null; }