public class NetcdfFiles extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
reservedFullName |
| Constructor and Description |
|---|
NetcdfFiles() |
| Modifier and Type | Method and Description |
|---|---|
static String |
canonicalizeUriString(String location)
Removes the
"file:" or "file://" prefix from the location, if necessary. |
static boolean |
canOpen(String location)
Find out if the location can be opened, but dont actually open it.
|
static RandomAccessFile |
getRaf(String location,
int buffer_size)
Get the appropriate RandomAccessFile for accessing an object at the provided location
|
static String |
makeFullName(Group g)
Create a Groups's full name with appropriate backslash escaping.
|
static String |
makeFullName(Variable v)
Create a Variable's full name with appropriate backslash escaping.
|
static String |
makeFullNameSectionSpec(Variable v)
Create a Variable's full name with
appropriate backslash escaping for use in a section spec.
|
static String |
makeValidCDLName(String vname)
Escape special characters in a netcdf short name when
it is intended for use in CDL.
|
static String |
makeValidCdmObjectName(String shortName)
Create a valid CDM object name.
|
static NetcdfFile |
open(RandomAccessFile raf,
String location,
CancelTask cancelTask,
Object iospMessage)
Open a RandomAccessFile as a NetcdfFile, if possible.
|
static NetcdfFile |
open(String location)
Open an existing netcdf file (read only).
|
static NetcdfFile |
open(String location,
CancelTask cancelTask)
Open an existing file (read only), with option of cancelling.
|
static NetcdfFile |
open(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(String location,
int buffer_size,
CancelTask cancelTask,
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(String location,
String iospClassName,
int bufferSize,
CancelTask cancelTask,
Object iospMessage)
Open an existing file (read only), specifying which IOSP is to be used.
|
static NetcdfFile |
openInMemory(String filename)
Read a local CDM file into memory.
|
static NetcdfFile |
openInMemory(String name,
byte[] data)
Open an in-memory netcdf file.
|
static NetcdfFile |
openInMemory(String name,
byte[] data,
String iospClassName)
Open an in-memory netcdf file, with a specific iosp.
|
static NetcdfFile |
openInMemory(URI uri)
Read a remote CDM file into memory.
|
static void |
registerIOProvider(Class iospClass)
Register an IOServiceProvider.
|
static void |
registerIOProvider(String className)
Register an IOServiceProvider, using its class string name.
|
static void |
registerRandomAccessFileProvider(Class rafClass)
Register a RandomAccessFile Provider.
|
static void |
registerRandomAccessFileProvider(String className)
Register a RandomAccessFile Provider, using its class string name.
|
public static final String reservedFullName
public static String canonicalizeUriString(String location)
"file:" or "file://" prefix from the location, if necessary. Also replaces
back slashes with forward slashes.location - a URI string.public static boolean canOpen(String location) throws IOException
RandomAccessFile implementation, and 2) a proper IOServiceProvider
implementation.location - location of fileIOException - on read errorpublic static RandomAccessFile getRaf(String location, int buffer_size) throws IOException
location - a URI string.buffer_size - size of the RandomAccessFileBufferIOExceptionpublic static String makeFullName(Group g)
public static String makeFullName(Variable v)
v - the Variablepublic static String makeFullNameSectionSpec(Variable v)
v - the cdm nodepublic static String makeValidCDLName(String vname)
vname - the namepublic static String makeValidCdmObjectName(String shortName)
shortName - from this namepublic static NetcdfFile open(RandomAccessFile raf, String location, CancelTask cancelTask, Object iospMessage) throws 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.IOException - if cannot open as a CDM NetCDF.public static NetcdfFile open(String location) throws IOException
location - location of file.IOException - if errorpublic static NetcdfFile open(String location, CancelTask cancelTask) throws IOException
location - location of the file.cancelTask - allow task to be cancelled; may be null.IOException - if errorpublic static NetcdfFile open(String location, int buffer_size, CancelTask cancelTask) throws IOException
location - location of file.buffer_size - RandomAccessFile buffer size, if <= 0, use default sizecancelTask - allow task to be cancelled; may be null.IOException - if errorpublic static NetcdfFile open(String location, int buffer_size, CancelTask cancelTask, Object iospMessage) throws 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 nullIOException - if errorpublic static NetcdfFile open(String location, String iospClassName, int bufferSize, CancelTask cancelTask, Object iospMessage) throws ClassNotFoundException, IllegalAccessException, InstantiationException, 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 nullIOException - if read errorClassNotFoundException - cannat find iospClassName in thye class pathInstantiationException - if class cannot be instantiatedIllegalAccessException - if class is not accessiblepublic static NetcdfFile openInMemory(String filename) throws IOException
filename - location of CDM file, must be a local file.IOException - if error reading filepublic static NetcdfFile openInMemory(String name, byte[] data) throws IOException
name - name of the dataset. Typically use the filename or URI.data - in-memory netcdf fileIOException - if errorpublic static NetcdfFile openInMemory(String name, byte[] data, String iospClassName) throws IOException, ClassNotFoundException, IllegalAccessException, 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 fileIOException - if read errorClassNotFoundException - cannat find iospClassName in the class pathInstantiationException - if class cannot be instantiatedIllegalAccessException - if class is not accessiblepublic static NetcdfFile openInMemory(URI uri) throws IOException
uri - location of CDM file, must be accessible through url.toURL().openStream().IOException - if error reading filepublic static void registerIOProvider(Class iospClass) throws IllegalAccessException, InstantiationException
iospClass - Class that implements IOServiceProvider.IllegalAccessException - if class is not accessible.InstantiationException - if class doesnt have a no-arg constructor.ClassCastException - if class doesnt implement IOServiceProvider interface.public static void registerIOProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException
className - Class that implements IOServiceProvider.IllegalAccessException - if class is not accessible.InstantiationException - if class doesnt have a no-arg constructor.ClassNotFoundException - if class not found.public static void registerRandomAccessFileProvider(Class rafClass) throws IllegalAccessException, InstantiationException
rafClass - Class that implements RandomAccessFileProvider.IllegalAccessException - if class is not accessible.InstantiationException - if class doesnt have a no-arg constructor.ClassCastException - if class doesnt implement IOServiceProvider interface.public static void registerRandomAccessFileProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException
className - Class that implements RandomAccessFileProvider.IllegalAccessException - if class is not accessible.InstantiationException - if class doesnt have a no-arg constructor.ClassNotFoundException - if class not found.