/** * Open the service provider for reading. * * @param raf file to read from * @param ncfile netCDF file we are writing to (memory) * @param cancelTask task for cancelling * @throws IOException problem reading file */ public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException { super.open(raf, ncfile, cancelTask); if (areaReader == null) areaReader = new AreaReader(); try { areaReader.init(raf.getLocation(), ncfile); } catch (Throwable e) { close(); // try not to leak files throw new IOException(e); } finally { raf.close(); // avoid leaks } }