|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.nc2.iosp.AbstractIOServiceProvider
public abstract class AbstractIOServiceProvider
Abstract base class for IOSP implementations that provides default implementations of readToByteChannel(...) and readSection(...).
Implementations should make sure to handle the RandomAccessFile properly by doing one of the following:
Field Summary | |
---|---|
protected RandomAccessFile |
raf
Subclasses that use AbstractIOServiceProvider.open(...) or .close() should use this (instead of their own private variable). |
Constructor Summary | |
---|---|
AbstractIOServiceProvider()
|
Method Summary | |
---|---|
void |
close()
Close the file. |
String |
getDetailInfo()
Show debug / underlying implementation details |
String |
getFileTypeVersion()
Get the version of this file type. |
StructureDataIterator |
getStructureIterator(Structure s,
int bufferSize)
|
void |
open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
Open existing file, and populate ncfile with it. |
Array |
readSection(ParsedSectionSpec cer)
Allows reading sections of nested variables |
long |
readToByteChannel(Variable v2,
Section section,
WritableByteChannel channel)
Read data from a top level Variable and send data to a WritableByteChannel. |
Object |
sendIospMessage(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. |
String |
toStringDebug(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, readData |
Field Detail |
---|
protected RandomAccessFile raf
Constructor Detail |
---|
public AbstractIOServiceProvider()
Method Detail |
---|
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
IOServiceProvider
open
in interface IOServiceProvider
raf
- the file to work on, it has already passed the isValidFile() test.ncfile
- add objects to this empty NetcdfFilecancelTask
- used to monitor user cancellation; may be null.
IOException
- if read errorpublic void close() throws IOException
IOServiceProvider
close
in interface IOServiceProvider
IOException
- if read errorpublic long readToByteChannel(Variable v2, Section section, WritableByteChannel channel) throws IOException, InvalidRangeException
IOServiceProvider
readToByteChannel
in interface IOServiceProvider
v2
- a top-level Variablesection
- 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
IOException
- if read error
InvalidRangeException
- if invalid sectionpublic Array readSection(ParsedSectionSpec cer) throws IOException, InvalidRangeException
IOServiceProvider
readSection
in interface IOServiceProvider
cer
- section specification : what data is wanted
IOException
- on read error
InvalidRangeException
- if section spec is invalidpublic StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws IOException
getStructureIterator
in interface IOServiceProvider
IOException
public Object sendIospMessage(Object message)
IOServiceProvider
sendIospMessage
in interface IOServiceProvider
message
- opaque message.
public boolean syncExtend() throws IOException
IOServiceProvider
syncExtend
in interface IOServiceProvider
IOException
- if a read error occured when accessing the underlying dataset.public boolean sync() throws IOException
IOServiceProvider
sync
in interface IOServiceProvider
IOException
- if a read error occured when accessing the underlying dataset.public String toStringDebug(Object o)
IOServiceProvider
toStringDebug
in interface IOServiceProvider
o
- which object
public String getDetailInfo()
IOServiceProvider
getDetailInfo
in interface IOServiceProvider
public String getFileTypeVersion()
IOServiceProvider
getFileTypeVersion
in interface IOServiceProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |