ucar.nc2.iosp
Class AbstractIOServiceProvider

java.lang.Object
  extended by ucar.nc2.iosp.AbstractIOServiceProvider
All Implemented Interfaces:
IOServiceProvider
Direct Known Subclasses:
AreaServiceProvider, BufrIosp, Cinrad2IOServiceProvider, DMSPiosp, Doradeiosp, Fysatiosp, GempakSurfaceIOSP, Giniiosp, GribServiceProvider, GridServiceProvider, GtopoIosp, H4iosp, H5iosp, N3iosp, NcStreamIosp, Nexrad2IOServiceProvider, Nidsiosp, Nldn, NmcObsLegacy, UAMIVServiceProvider, UFiosp, Uspln

public abstract class AbstractIOServiceProvider
extends java.lang.Object
implements IOServiceProvider


Field Summary
protected  RandomAccessFile raf
           
 
Constructor Summary
AbstractIOServiceProvider()
           
 
Method Summary
 void close()
          Close the file.
static long copyToByteChannel(Array data, java.nio.channels.WritableByteChannel channel)
           
static java.lang.String createValidNetcdfObjectName(java.lang.String name)
           
 java.lang.String getDetailInfo()
          Show debug / underlying implementation details
 java.lang.String getFileTypeVersion()
          Get the version of this file type.
 StructureDataIterator getStructureIterator(Structure s, int bufferSize)
           
 Array readSection(ParsedSectionSpec cer)
          Allows reading sections of nested variables
 long readToByteChannel(Variable v2, Section section, java.nio.channels.WritableByteChannel channel)
          Read data from a top level Variable and send data to a WritableByteChannel.
 java.lang.Object sendIospMessage(java.lang.Object message)
          A way to communicate arbitrary information to an iosp.
 boolean sync()
          Update the metadata in the NetcdfFile if the underlying dataset has changed.
 boolean syncExtend()
          Extend the NetcdfFile if the underlying dataset has changed in a way that is compatible with the current metadata.
 java.lang.String toStringDebug(java.lang.Object o)
          Debug info for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
getFileTypeDescription, getFileTypeId, isValidFile, open, readData
 

Field Detail

raf

protected RandomAccessFile raf
Constructor Detail

AbstractIOServiceProvider

public AbstractIOServiceProvider()
Method Detail

createValidNetcdfObjectName

public static java.lang.String createValidNetcdfObjectName(java.lang.String name)

close

public void close()
           throws java.io.IOException
Description copied from interface: IOServiceProvider
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.

Specified by:
close in interface IOServiceProvider
Throws:
java.io.IOException - if read error

readToByteChannel

public long readToByteChannel(Variable v2,
                              Section section,
                              java.nio.channels.WritableByteChannel channel)
                       throws java.io.IOException,
                              InvalidRangeException
Description copied from interface: IOServiceProvider
Read data from a top level Variable and send data to a WritableByteChannel. Must be in big-endian order.

Specified by:
readToByteChannel in interface IOServiceProvider
Parameters:
v2 - a top-level Variable
section - the section of data to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed. IOSP may not modify.
channel - write data to this WritableByteChannel
Returns:
the number of bytes written to the channel
Throws:
java.io.IOException - if read error
InvalidRangeException - if invalid section

copyToByteChannel

public static long copyToByteChannel(Array data,
                                     java.nio.channels.WritableByteChannel channel)
                              throws java.io.IOException,
                                     InvalidRangeException
Throws:
java.io.IOException
InvalidRangeException

readSection

public Array readSection(ParsedSectionSpec cer)
                  throws java.io.IOException,
                         InvalidRangeException
Description copied from interface: IOServiceProvider
Allows reading sections of nested variables

Specified by:
readSection in interface IOServiceProvider
Returns:
requested data array
Throws:
java.io.IOException
InvalidRangeException

getStructureIterator

public StructureDataIterator getStructureIterator(Structure s,
                                                  int bufferSize)
                                           throws java.io.IOException
Throws:
java.io.IOException

sendIospMessage

public java.lang.Object sendIospMessage(java.lang.Object message)
Description copied from interface: IOServiceProvider
A way to communicate arbitrary information to an iosp.

Specified by:
sendIospMessage in interface IOServiceProvider
Parameters:
message - opaque message.
Returns:
opaque return, may be null.

syncExtend

public boolean syncExtend()
                   throws java.io.IOException
Description copied from interface: IOServiceProvider
Extend the NetcdfFile if the underlying dataset has changed in a way that is compatible with the current metadata. For example, if the unlimited dimension has grown.

Specified by:
syncExtend in interface IOServiceProvider
Returns:
true if the NetcdfFile was extended.
Throws:
java.io.IOException - if a read error occured when accessing the underlying dataset.

sync

public boolean sync()
             throws java.io.IOException
Description copied from interface: IOServiceProvider
Update the metadata in the NetcdfFile if the underlying dataset has changed.

Specified by:
sync in interface IOServiceProvider
Returns:
true if the NetcdfFile was changed.
Throws:
java.io.IOException - if a read error occured when accessing the underlying dataset.

toStringDebug

public java.lang.String toStringDebug(java.lang.Object o)
Description copied from interface: IOServiceProvider
Debug info for this object.

Specified by:
toStringDebug in interface IOServiceProvider
Parameters:
o - which object
Returns:
debug info for this object

getDetailInfo

public java.lang.String getDetailInfo()
Description copied from interface: IOServiceProvider
Show debug / underlying implementation details

Specified by:
getDetailInfo in interface IOServiceProvider
Returns:
debug info

getFileTypeVersion

public java.lang.String getFileTypeVersion()
Description copied from interface: IOServiceProvider
Get the version of this file type.

Specified by:
getFileTypeVersion in interface IOServiceProvider
Returns:
version of the file type
See Also:
"http://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"