static private NetcdfFile openOrAcquireFile(FileCache cache, FileFactory factory, Object hashKey, DatasetUrl durl,
                                              int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException {
    """
	/*
	Open or acquire a NetcdfFile.
	
	@param cache       if not null, acquire through this NetcdfFileCache, otherwise simply open
	@param factory     if not null, use this factory if the file is not in the cache. If null, use the default factory.
	@param hashKey     if not null, use as the cache key, else use the location
	@param orgLocation location of file
	@param buffer_size RandomAccessFile buffer size, if <= 0, use default size
	@param cancelTask  allow task to be cancelled; may be null.
	@param spiObject   sent to iosp.setSpecial() if not null
	@return NetcdfFile object
	@throws java.io.IOException on read error
	
	static private NetcdfFile openOrAcquireFile(FileCache cache, FileFactory factory, Object hashKey, String orgLocation,
	int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException {
	
	if (orgLocation == null)
	throw new IOException("NetcdfDataset.openFile: location is null");
	
	String location = StringUtil2.replace(orgLocation.trim(), '\\', "/");
	DatasetUrl durl = DatasetUrl.findDatasetUrl(location);
	return openOrAcquireFile(cache, factory, hashKey, durl, buffer_size, cancelTask, spiObject);
	}
    """

    if (durl.serviceType != null) {
      switch (durl.serviceType) {

        case OPENDAP:
          return acquireDODS(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case CdmRemote:
          return acquireCdmRemote(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case DAP4:
          return acquireDap4(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case NCML:
          return acquireNcml(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case THREDDS:
          Formatter log = new Formatter();
          DataFactory tdf = new DataFactory();
          NetcdfFile ncfile = tdf.openDataset(durl.trueurl, false, cancelTask, log); // LOOK acquire ??
          if (ncfile == null)
            throw new IOException(log.toString());
          return ncfile;

        case File:
        case HTTPServer:
          break; // fall through

        default:
          throw new IOException("Unknown service type: " + durl.serviceType.toString());
      }
    }

    // Next to last resort: find in the cache
    if (cache != null) {
      if (factory == null) factory = defaultNetcdfFileFactory;
      return (NetcdfFile) cache.acquire(factory, hashKey, durl, buffer_size, cancelTask, spiObject);
    }

    // Last resort: try to open as a file or remote file
    return NetcdfFile.open(durl.trueurl, buffer_size, cancelTask, spiObject);
  }
static private NetcdfFile openOrAcquireFile(FileCache cache, FileFactory factory, Object hashKey, DatasetUrl durl,
                                              int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException {

    if (durl.serviceType != null) {
      switch (durl.serviceType) {

        case OPENDAP:
          return acquireDODS(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case CdmRemote:
          return acquireCdmRemote(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case DAP4:
          return acquireDap4(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case NCML:
          return acquireNcml(cache, factory, hashKey, durl.trueurl, buffer_size, cancelTask, spiObject);

        case THREDDS:
          Formatter log = new Formatter();
          DataFactory tdf = new DataFactory();
          NetcdfFile ncfile = tdf.openDataset(durl.trueurl, false, cancelTask, log); // LOOK acquire ??
          if (ncfile == null)
            throw new IOException(log.toString());
          return ncfile;

        case File:
        case HTTPServer:
          break; // fall through

        default:
          throw new IOException("Unknown service type: " + durl.serviceType.toString());
      }
    }

    // Next to last resort: find in the cache
    if (cache != null) {
      if (factory == null) factory = defaultNetcdfFileFactory;
      return (NetcdfFile) cache.acquire(factory, hashKey, durl, buffer_size, cancelTask, spiObject);
    }

    // Last resort: try to open as a file or remote file
    return NetcdfFile.open(durl.trueurl, buffer_size, cancelTask, spiObject);
  }
static private NetcdfFile openOrAcquireFile ( FileCache cache , FileFactory factory , Object hashKey , DatasetUrl durl , int buffer_size , ucar . nc2 . util . CancelTask cancelTask , Object spiObject ) throws IOException { if ( durl . serviceType != null ) { switch ( durl . serviceType ) { case OPENDAP : return acquireDODS ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case CdmRemote : return acquireCdmRemote ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case DAP4 : return acquireDap4 ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case NCML : return acquireNcml ( cache , factory , hashKey , durl . trueurl , buffer_size , cancelTask , spiObject ) ; case THREDDS : Formatter log = new Formatter ( ) ; DataFactory tdf = new DataFactory ( ) ; NetcdfFile ncfile = tdf . openDataset ( durl . trueurl , false , cancelTask , log ) ; // LOOK acquire ?? if ( ncfile == null ) throw new IOException ( log . toString ( ) ) ; return ncfile ; case File : case HTTPServer : break ; // fall through default : throw new IOException ( "Unknown service type: " + durl . serviceType . toString ( ) ) ; } } // Next to last resort: find in the cache if ( cache != null ) { if ( factory == null ) factory = defaultNetcdfFileFactory ; return ( NetcdfFile ) cache . acquire ( factory , hashKey , durl , buffer_size , cancelTask , spiObject ) ; } // Last resort: try to open as a file or remote file return NetcdfFile . open ( durl . trueurl , buffer_size , cancelTask , spiObject ) ; }
/*
Open or acquire a NetcdfFile.

@param cache       if not null, acquire through this NetcdfFileCache, otherwise simply open
@param factory     if not null, use this factory if the file is not in the cache. If null, use the default factory.
@param hashKey     if not null, use as the cache key, else use the location
@param orgLocation location of file
@param buffer_size RandomAccessFile buffer size, if <= 0, use default size
@param cancelTask  allow task to be cancelled; may be null.
@param spiObject   sent to iosp.setSpecial() if not null
@return NetcdfFile object
@throws java.io.IOException on read error

static private NetcdfFile openOrAcquireFile(FileCache cache, FileFactory factory, Object hashKey, String orgLocation,
int buffer_size, ucar.nc2.util.CancelTask cancelTask, Object spiObject) throws IOException {

if (orgLocation == null)
throw new IOException("NetcdfDataset.openFile: location is null");

String location = StringUtil2.replace(orgLocation.trim(), '\\', "/");
DatasetUrl durl = DatasetUrl.findDatasetUrl(location);
return openOrAcquireFile(cache, factory, hashKey, durl, buffer_size, cancelTask, spiObject);
}
/ * Open or acquire a NetcdfFile .