public class NetcdfFiles
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
reservedFullName |
| Constructor and Description |
|---|
NetcdfFiles() |
| Modifier and Type | Method and Description |
|---|---|
static NetcdfFile |
build(IOServiceProvider spi,
RandomAccessFile raf,
java.lang.String location,
CancelTask cancelTask) |
static java.lang.String |
canonicalizeUriString(java.lang.String location)
Removes the
"file:" or "file://" prefix from the location, if necessary. |
static boolean |
canOpen(java.lang.String location)
Find out if the location can be opened, but dont actually open it.
|
static RandomAccessFile |
getRaf(java.lang.String location,
int buffer_size)
Get the appropriate RandomAccessFile for accessing an object at the provided location
|
static java.lang.String |
makeFullName(Group g)
Create a Groups's full name with appropriate backslash escaping.
|
static java.lang.String |
makeFullName(Variable v)
Create a Variable's full name with appropriate backslash escaping.
|
static java.lang.String |
makeFullNameSectionSpec(Variable v)
Create a Variable's full name with
appropriate backslash escaping for use in a section spec.
|
protected static java.lang.String |
makeFullNameWithString(Group parent,
java.lang.String name)
Create a synthetic full name from a group plus a string
|
static java.lang.String |
makeValidCDLName(java.lang.String vname)
Escape special characters in a netcdf short name when
it is intended for use in CDL.
|
static java.lang.String |
makeValidCdmObjectName(java.lang.String shortName)
Create a valid CDM object name.
|
static java.lang.String |
makeValidPathName(java.lang.String vname)
Escape special characters in a netcdf short name when
it is intended for use in a fullname
|
static java.lang.String |
makeValidSectionSpecName(java.lang.String vname)
Escape special characters in a netcdf short name when
it is intended for use in a sectionSpec
|
static NetcdfFile |
open(RandomAccessFile raf,
java.lang.String location,
CancelTask cancelTask,
java.lang.Object iospMessage)
Open a RandomAccessFile as a NetcdfFile, if possible.
|
static NetcdfFile |
open(java.lang.String location)
Open an existing netcdf file (read only).
|
static NetcdfFile |
open(java.lang.String location,
CancelTask cancelTask)
Open an existing file (read only), with option of cancelling.
|
static NetcdfFile |
open(java.lang.String location,
int buffer_size,
CancelTask cancelTask)
Open an existing file (read only), with option of cancelling, setting the RandomAccessFile buffer size for
efficiency.
|
static NetcdfFile |
open(java.lang.String location,
int buffer_size,
CancelTask cancelTask,
java.lang.Object iospMessage)
Open an existing file (read only), with option of cancelling, setting the RandomAccessFile buffer size for
efficiency, with an optional special object for the iosp.
|
static NetcdfFile |
open(java.lang.String location,
java.lang.String iospClassName,
int bufferSize,
CancelTask cancelTask,
java.lang.Object iospMessage)
Open an existing file (read only), specifying which IOSP is to be used.
|
static NetcdfFile |
openInMemory(java.lang.String filename)
Read a local CDM file into memory.
|
static NetcdfFile |
openInMemory(java.lang.String name,
byte[] data)
Open an in-memory netcdf file.
|
static NetcdfFile |
openInMemory(java.lang.String name,
byte[] data,
java.lang.String iospClassName)
Open an in-memory netcdf file, with a specific iosp.
|
static NetcdfFile |
openInMemory(java.net.URI uri)
Read a remote CDM file into memory.
|
static void |
registerIOProvider(java.lang.Class iospClass)
Register an IOServiceProvider.
|
static void |
registerIOProvider(java.lang.String className)
Register an IOServiceProvider, using its class string name.
|
static void |
registerRandomAccessFileProvider(java.lang.Class rafClass)
Register a RandomAccessFile Provider.
|
static void |
registerRandomAccessFileProvider(java.lang.String className)
Register a RandomAccessFile Provider, using its class string name.
|
public static final java.lang.String reservedFullName
public static void registerIOProvider(java.lang.String className)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.ClassNotFoundException
className - Class that implements IOServiceProvider.java.lang.IllegalAccessException - if class is not accessible.java.lang.InstantiationException - if class doesnt have a no-arg constructor.java.lang.ClassNotFoundException - if class not found.public static void registerIOProvider(java.lang.Class iospClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
iospClass - Class that implements IOServiceProvider.java.lang.IllegalAccessException - if class is not accessible.java.lang.InstantiationException - if class doesnt have a no-arg constructor.java.lang.ClassCastException - if class doesnt implement IOServiceProvider interface.public static void registerRandomAccessFileProvider(java.lang.String className)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.ClassNotFoundException
className - Class that implements RandomAccessFileProvider.java.lang.IllegalAccessException - if class is not accessible.java.lang.InstantiationException - if class doesnt have a no-arg constructor.java.lang.ClassNotFoundException - if class not found.public static void registerRandomAccessFileProvider(java.lang.Class rafClass)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
rafClass - Class that implements RandomAccessFileProvider.java.lang.IllegalAccessException - if class is not accessible.java.lang.InstantiationException - if class doesnt have a no-arg constructor.java.lang.ClassCastException - if class doesnt implement IOServiceProvider interface.public static NetcdfFile open(java.lang.String location) throws java.io.IOException
location - location of file.java.io.IOException - if errorpublic static NetcdfFile open(java.lang.String location, CancelTask cancelTask) throws java.io.IOException
location - location of the file.cancelTask - allow task to be cancelled; may be null.java.io.IOException - if errorpublic static NetcdfFile open(java.lang.String location, int buffer_size, CancelTask cancelTask) throws java.io.IOException
location - location of file.buffer_size - RandomAccessFile buffer size, if <= 0, use default sizecancelTask - allow task to be cancelled; may be null.java.io.IOException - if errorpublic static NetcdfFile open(java.lang.String location, int buffer_size, CancelTask cancelTask, java.lang.Object iospMessage) throws java.io.IOException
location - location of file. This may be a
buffer_size - RandomAccessFile buffer size, if <= 0, use default sizecancelTask - allow task to be cancelled; may be null.iospMessage - special iosp tweaking (sent before open is called), may be nulljava.io.IOException - if errorpublic static NetcdfFile open(java.lang.String location, java.lang.String iospClassName, int bufferSize, CancelTask cancelTask, java.lang.Object iospMessage) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.io.IOException
location - location of fileiospClassName - fully qualified class name of the IOSP class to handle this filebufferSize - RandomAccessFile buffer size, if <= 0, use default sizecancelTask - allow task to be cancelled; may be null.iospMessage - special iosp tweaking (sent before open is called), may be nulljava.io.IOException - if read errorjava.lang.ClassNotFoundException - cannot find iospClassName in the class pathjava.lang.InstantiationException - if class cannot be instantiatedjava.lang.IllegalAccessException - if class is not accessiblepublic static boolean canOpen(java.lang.String location)
throws java.io.IOException
RandomAccessFile implementation, and 2) a proper IOServiceProvider
implementation.location - location of filejava.io.IOException - on read errorpublic static java.lang.String canonicalizeUriString(java.lang.String location)
"file:" or "file://" prefix from the location, if necessary. Also replaces
back slashes with forward slashes.location - a URI string.public static RandomAccessFile getRaf(java.lang.String location, int buffer_size) throws java.io.IOException
location - a URI string.buffer_size - size of the RandomAccessFileBufferjava.io.IOExceptionpublic static NetcdfFile openInMemory(java.lang.String filename) throws java.io.IOException
filename - location of CDM file, must be a local file.java.io.IOException - if error reading filepublic static NetcdfFile openInMemory(java.net.URI uri) throws java.io.IOException
uri - location of CDM file, must be accessible through url.toURL().openStream().java.io.IOException - if error reading filepublic static NetcdfFile openInMemory(java.lang.String name, byte[] data) throws java.io.IOException
name - name of the dataset. Typically use the filename or URI.data - in-memory netcdf filejava.io.IOException - if errorpublic static NetcdfFile openInMemory(java.lang.String name, byte[] data, java.lang.String iospClassName) throws java.io.IOException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
name - name of the dataset. Typically use the filename or URI.data - in-memory netcdf fileiospClassName - fully qualified class name of the IOSP class to handle this filejava.io.IOException - if read errorjava.lang.ClassNotFoundException - cannat find iospClassName in the class pathjava.lang.InstantiationException - if class cannot be instantiatedjava.lang.IllegalAccessException - if class is not accessiblepublic static NetcdfFile open(RandomAccessFile raf, java.lang.String location, CancelTask cancelTask, java.lang.Object iospMessage) throws java.io.IOException
raf - The open raf, is not cloised by this method.location - human readable locatoin of this dataset.cancelTask - used to monitor user cancellation; may be null.iospMessage - send this message to iosp; may be null.java.io.IOException - if cannot open as a CDM NetCDF.public static NetcdfFile build(IOServiceProvider spi, RandomAccessFile raf, java.lang.String location, CancelTask cancelTask) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String makeValidCdmObjectName(java.lang.String shortName)
shortName - from this namepublic static java.lang.String makeValidCDLName(java.lang.String vname)
vname - the namepublic static java.lang.String makeValidPathName(java.lang.String vname)
vname - the namepublic static java.lang.String makeValidSectionSpecName(java.lang.String vname)
vname - the namepublic static java.lang.String makeFullName(Group g)
public static java.lang.String makeFullName(Variable v)
v - the Variablepublic static java.lang.String makeFullNameSectionSpec(Variable v)
v - the cdm nodeprotected static java.lang.String makeFullNameWithString(Group parent, java.lang.String name)
parent - parent groupname - synthetic name string