ucar.nc2
Interface IOServiceProvider

All Known Subinterfaces:
IOServiceProviderWriter
All Known Implementing Classes:
N3iosp

public interface IOServiceProvider

This is the service provider interface for the low-level I/O access classes (read only). This is only used by service implementors.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
caron

Method Summary
 void close()
          Close the file.
 java.lang.String getDetailInfo()
          Show debug / underlying implementation details
 boolean isValidFile(RandomAccessFile raf)
          Check if this is a valid file for this IOServiceProvider.
 void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
          Open existing file, and populate ncfile with it.
 Array readData(Variable v2, java.util.List section)
          Read data from a top level Variable and return a memory resident Array.
 Array readNestedData(Variable v2, java.util.List section)
          Read data from a Variable that is nested in one or more Structures.
 void setSpecial(java.lang.Object special)
          A way to communicate arbitrary information to an iosp.
 boolean sync()
          Check if file has changed, and reread metadata if needed.
 boolean syncExtend()
          Extend the file if needed in a way that is compatible with the current metadata.
 java.lang.String toStringDebug(java.lang.Object o)
          Debug info for this object.
 

Method Detail

isValidFile

boolean isValidFile(RandomAccessFile raf)
                    throws java.io.IOException
Check if this is a valid file for this IOServiceProvider.

Parameters:
raf - RandomAccessFile
Returns:
true if valid.
Throws:
java.io.IOException

open

void open(RandomAccessFile raf,
          NetcdfFile ncfile,
          CancelTask cancelTask)
          throws java.io.IOException
Open existing file, and populate ncfile with it.

Parameters:
raf - the file to work on, it has already passed the isValidFile() test.
ncfile - add objects to this NetcdfFile
cancelTask - used to monito user cancellation; may be null.
Throws:
java.io.IOException

readData

Array readData(Variable v2,
               java.util.List section)
               throws java.io.IOException,
                      InvalidRangeException
Read data from a top level Variable and return a memory resident Array. This Array has the same element type as the Variable, and the requested shape.

Parameters:
v2 - a top-level Variable
section - List of type Range specifying the section of data to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls.
Returns:
the requested data in a memory-resident Array
Throws:
java.io.IOException
InvalidRangeException
See Also:
Range

readNestedData

Array readNestedData(Variable v2,
                     java.util.List section)
                     throws java.io.IOException,
                            InvalidRangeException
Read data from a Variable that is nested in one or more Structures. If there are no Structures in the file, this will never be called. Return an Array of the same type as the Variable and the requested shape. The shape must be an accumulation of all the shapes of the Structures containing the variable.

v2.getParent() is called to get the containing Structures.

Parameters:
v2 - a nested Variable.
section - List of type Range specifying the section of data to read. There must be a Range for each Dimension in each parent, as well as in the Variable itself. Must be in order from outer to inner. Note: no nulls.
Returns:
the requested data in a memory-resident Array
Throws:
java.io.IOException
InvalidRangeException

close

void close()
           throws java.io.IOException
Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it), and to free any other resources it has used.

Throws:
java.io.IOException

syncExtend

boolean syncExtend()
                   throws java.io.IOException
Extend the file if needed in a way that is compatible with the current metadata. For example, if the unlimited dimension has grown.

Returns:
true if file was exteneed.
Throws:
java.io.IOException

sync

boolean sync()
             throws java.io.IOException
Check if file has changed, and reread metadata if needed.

Returns:
true if file was changed.
Throws:
java.io.IOException

setSpecial

void setSpecial(java.lang.Object special)
A way to communicate arbitrary information to an iosp. Typically this is set before open() is called.

Parameters:
special - opaque special settings.

toStringDebug

java.lang.String toStringDebug(java.lang.Object o)
Debug info for this object.


getDetailInfo

java.lang.String getDetailInfo()
Show debug / underlying implementation details