Tabnine Logo
IOServiceProvider
Code IndexAdd Tabnine to your IDE (free)

How to use
IOServiceProvider
in
ucar.nc2.iosp

Best Java code snippets using ucar.nc2.iosp.IOServiceProvider (Showing top 20 results out of 315)

origin: edu.ucar/netcdf

/**
 * Get the file type id for the underlying data source.
 *
 * @return registered id of the file type
 * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
 */
public String getFileTypeId() {
 if (spi != null) return spi.getFileTypeId();
 return "N/A";
}
origin: edu.ucar/cdm

/**
 * Get a human-readable description for this file type.
 *
 * @return description of the file type
 * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
 */
public String getFileTypeDescription() {
 if (spi != null) return spi.getFileTypeDescription();
 return "N/A";
}
origin: edu.ucar/netcdf

/**
 * Get the version of this file type.
 *
 * @return version of the file type
 * @see "http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
 */
public String getFileTypeVersion() {
 if (spi != null) return spi.getFileTypeVersion();
 return "N/A";
}
origin: Unidata/thredds

spi = (IOServiceProvider) iospClass.newInstance();
if (debugSPI) log.info("NetcdfFile uses iosp = {}", spi.getClass().getName());
if (iospParam != null) spi.sendIospMessage(iospParam);
 this.spi.open(raf, this, cancelTask);
 finish();
  spi.close();
 } catch (Throwable t1) {
  spi.close();
 } catch (Throwable t1) {
origin: edu.ucar/cdm

spi.open(raf, this, cancelTask);
 spi.close();
} catch (Throwable t1) {
 spi.close();
} catch (Throwable t1) {
 spi.close();
} catch (Throwable t1) {
origin: edu.ucar/cdm

 if (currentSpi.isValidFile(raf)) {
  Class c = currentSpi.getClass();
  try {
 if (debugSPI) System.out.println(" try iosp = " + registeredSpi.getClass().getName());
 if (registeredSpi.isValidFile(raf)) {
spi.sendIospMessage(iospMessage);
spi.sendIospMessage(iospMessage);
origin: edu.ucar/cdm

/**
 * This can only be used for netcdf-3 files served over HTTP
 *
 * @param url HTTP URL location
 * @throws java.io.IOException if error
 * @deprecated use NetcdfFile.open( http:location) or NetcdfDataset.openFile( http:location)
 */
public NetcdfFile(URL url) throws IOException {
 this.location = url.toString();
 ucar.unidata.io.RandomAccessFile raf = new ucar.unidata.io.http.HTTPRandomAccessFile(location);
 this.spi = SPFactory.getServiceProvider();
 spi.open(raf, this, null);
 finish();
}
origin: edu.ucar/netcdf

protected StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws java.io.IOException {
 return spi.getStructureIterator(s, bufferSize);
}
origin: Unidata/thredds

private static boolean canOpen(ucar.unidata.io.RandomAccessFile raf) throws IOException {
 if (N3header.isValidFile(raf)) {
  return true;
 } else {
  for (IOServiceProvider iosp : ServiceLoader.load(IOServiceProvider.class)) {
   log.info("ServiceLoader IOServiceProvider {}", iosp.getClass().getName());        if (iosp.isValidFile(raf)) {
    return true;
   }
  }
  for (IOServiceProvider registeredSpi : registeredProviders) {
   if (registeredSpi.isValidFile(raf))
    return true;
  }
 }
 return false;
}
origin: Unidata/thredds

public void getDetailInfo(Formatter f) {
 f.format("NetcdfFile location= %s%n", getLocation());
 f.format("  title= %s%n", getTitle());
 f.format("  id= %s%n", getId());
 f.format("  fileType= %s%n", getFileTypeId());
 f.format("  fileDesc= %s%n", getFileTypeDescription());
 f.format("  fileVersion= %s%n", getFileTypeVersion());
 f.format("  class= %s%n", getClass().getName());
 if (spi == null) {
  f.format("  has no IOSP%n");
 } else {
  f.format("  iosp= %s%n%n", spi.getClass());
  f.format("%s", spi.getDetailInfo());
 }
 showCached(f);
 showProxies(f);
}
origin: Unidata/thredds

/**
 * Close all resources (files, sockets, etc) associated with this file.
 * If the underlying file was acquired, it will be released, otherwise closed.
 * if isClosed() already, nothing will happen
 *
 * @throws java.io.IOException if error when closing
 */
public synchronized void close() throws java.io.IOException {
 if (cache != null) {
  if (cache.release(this))
   return;
 }
 try {
  if (null != spi) {
   // log.warn("NetcdfFile.close called for ncfile="+this.hashCode()+" for iosp="+spi.hashCode());
   spi.close();
  }
 } finally {
  spi = null;
 }
}
origin: Unidata/thredds

/**
 * Read a variable using the given section specification.
 * The result is always an array of the type of the innermost variable.
 * Its shape is the accumulation of all the shapes of its parent structures.
 *
 * @param variableSection the constraint expression.
 * @return data requested
 * @throws IOException           if error
 * @throws InvalidRangeException if variableSection is invalid
 * @see <a href="http://www.unidata.ucar.edu/software/netcdf-java/reference/SectionSpecification.html">SectionSpecification</a>
 */
public Array readSection(String variableSection) throws IOException, InvalidRangeException {
 /* if (unlocked)
  throw new IllegalStateException("File is unlocked - cannot use"); */
 ParsedSectionSpec cer = ParsedSectionSpec.parseVariableSection(this, variableSection);
 if (cer.child == null) {
  return cer.v.read(cer.section);
 }
 if (spi == null)
  return IospHelper.readSection(cer);
 else
  // allow iosp to optimize
  return spi.readSection(cer);
}
origin: Unidata/thredds

protected Array readData(ucar.nc2.Variable v, Section ranges) throws IOException, InvalidRangeException {
 long start = 0;
 if (showRequest) {
  log.info("Data request for variable: {} section {}...", v.getFullName(), ranges);
  start = System.currentTimeMillis();
 }
 /* if (unlocked) {
  String info = cache.getInfo(this);
  throw new IllegalStateException("File is unlocked - cannot use\n" + info);
 } */
 if (spi == null) {
  throw new IOException("spi is null, perhaps file has been closed. Trying to read variable " + v.getFullName());
 }
 Array result = spi.readData(v, ranges);
 if (showRequest) {
  long took = System.currentTimeMillis() - start;
  log.info(" ...took= {} msecs", took);
 }
 return result;
}
origin: edu.ucar/netcdf

spi = (IOServiceProvider) iospClass.newInstance();
if (debugSPI) System.out.println("NetcdfFile uses iosp = " + spi.getClass().getName());
if (iospParam != null) spi.sendIospMessage(iospParam);
 this.spi.open(raf, this, cancelTask);
 finish();
  spi.close();
 } catch (Throwable t1) {
  spi.close();
 } catch (Throwable t1) {
  spi.close();
 } catch (Throwable t1) {
origin: Unidata/thredds

spi.open(raf, this, cancelTask);
 spi.close();
} catch (Throwable t1) {
 spi.close();
} catch (Throwable t1) {
origin: Unidata/thredds

 if (currentSpi.isValidFile(raf)) {
  Class c = currentSpi.getClass();
  try {
 if (debugSPI) log.info(" try iosp = {}", registeredSpi.getClass().getName());
 if (registeredSpi.isValidFile(raf)) {
spi.sendIospMessage(iospMessage);
spi.sendIospMessage(iospMessage);
origin: Unidata/thredds

/**
 * This can only be used for netcdf-3 files served over HTTP
 *
 * @param url HTTP URL location
 * @throws java.io.IOException if error
 * @deprecated use NetcdfFile.open( http:location) or NetcdfDataset.openFile( http:location)
 */
public NetcdfFile(URL url) throws IOException {
 this.location = url.toString();
 ucar.unidata.io.RandomAccessFile raf = new ucar.unidata.io.http.HTTPRandomAccessFile(location);
 this.spi = SPFactory.getServiceProvider();
 spi.open(raf, this, null);
 finish();
}
origin: edu.ucar/cdm

protected StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws java.io.IOException {
 return spi.getStructureIterator(s, bufferSize);
}
origin: edu.ucar/netcdf

private static boolean canOpen(ucar.unidata.io.RandomAccessFile raf) throws IOException {
 if (N3header.isValidFile(raf)) {
  return true;
 } else {
  Iterator<IOServiceProvider> iterator = ServiceLoader.load(IOServiceProvider.class).iterator();
  while(iterator.hasNext()) {
    if (iterator.next().isValidFile(raf)) {
      return true;
    }
  }
  for (IOServiceProvider registeredSpi : registeredProviders) {
   if (registeredSpi.isValidFile(raf))
    return true;
  }
 }
 return false;
}
origin: edu.ucar/netcdf

public void getDetailInfo(Formatter f) {
 f.format("NetcdfFile location= %s%n", getLocation());
 f.format("  title= %s%n", getTitle());
 f.format("  id= %s%n", getId());
 f.format("  fileType= %s%n", getFileTypeId());
 f.format("  fileDesc= %s%n", getFileTypeDescription());
 f.format("  class= %s%n", getClass().getName());
 if (spi == null) {
  f.format("  has no IOSP%n");
 } else {
  f.format("  iosp= %s%n%n", spi.getClass());
  f.format("%s", spi.getDetailInfo());
 }
 showCached(f);
 showProxies(f);
}
ucar.nc2.iospIOServiceProvider

Javadoc

This is the service provider interface for the low-level I/O access classes (read only). This is only used by service implementors. The NetcdfFile class manages all registered IOServiceProvider classes. When NetcdfFile.open() is called:
  1. the file is opened as a ucar.unidata.io.RandomAccessFile;
  2. the file is handed to the isValidFile() method of each registered IOServiceProvider class (until one returns true, which means it can read the file).
  3. the open() method on the resulting IOServiceProvider class is handed the file.

Most used methods

  • getFileTypeId
    Get a unique id for this file type.
  • close
    Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it),
  • getDetailInfo
    Show debug / underlying implementation details
  • getFileTypeDescription
    Get a human-readable description for this file type.
  • getFileTypeVersion
    Get the version of this file type.
  • getStructureIterator
    Get the structure iterator. iosps with top level sequences must override
  • isValidFile
    Check if this is a valid file for this IOServiceProvider. You must make this method thread safe, ie
  • open
    Open existing file, and populate ncfile with it. This method is only called by the NetcdfFile constr
  • readData
    Read data from a top level Variable and return a memory resident Array. This Array has the same elem
  • readSection
    Allows reading sections of nested variables
  • readToByteChannel
    Read data from a top level Variable and send data to a WritableByteChannel. Must be in big-endian or
  • readToOutputStream
  • readToByteChannel,
  • readToOutputStream,
  • sendIospMessage,
  • syncExtend,
  • toStringDebug,
  • reacquire,
  • release

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Reference (javax.naming)
  • JList (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now