public abstract class AbstractIOServiceProvider extends java.lang.Object implements IOServiceProvider
Implementations should make sure to handle the RandomAccessFile properly by doing one of the following:
IOServiceProvider.SortGroup
Constructor and Description |
---|
AbstractIOServiceProvider() |
Modifier and Type | Method and Description |
---|---|
void |
build(RandomAccessFile raf,
Group.Builder rootGroup,
CancelTask cancelTask)
Open existing file, and populate it.
|
void |
buildFinish(NetcdfFile ncfile)
Sometimes the builder needs access to the finished objects.
|
void |
close()
Close the file.
|
java.lang.String |
getDetailInfo()
Show debug / underlying implementation details
|
java.lang.String |
getFileTypeVersion()
Get the version of this file type.
|
long |
getLastModified()
Returns the time that the underlying file(s) were last modified.
|
StructureDataIterator |
getStructureIterator(Structure s,
int bufferSize)
Get the structure iterator.
|
boolean |
isBuilder()
If this iosp implements build().
|
void |
open(RandomAccessFile raf,
NetcdfFile ncfile,
CancelTask cancelTask)
Open existing file, and populate ncfile with it.
|
void |
reacquire()
Reacquire any resources like file handles
Used when reactivating in cache.
|
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.
|
long |
readToOutputStream(Variable v2,
Section section,
java.io.OutputStream out)
Read data from a top level Variable and send data to a OutputStream.
|
void |
release()
Release any system resources like file handles.
|
java.lang.Object |
sendIospMessage(java.lang.Object message)
A way to communicate arbitrary information to and from an iosp.
|
void |
setNetcdfFile(NetcdfFile ncfile) |
long |
streamToByteChannel(Variable v2,
Section section,
java.nio.channels.WritableByteChannel channel) |
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.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compareTo, getFileTypeDescription, getFileTypeId, getSortGroup, isValidFile, readData
public void build(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask) throws java.io.IOException
IOServiceProvider
build
in interface IOServiceProvider
raf
- the file to work on, it has already passed the isValidFile() test.rootGroup
- add objects to the root group.cancelTask
- used to monitor user cancellation; may be null.java.io.IOException
- if read errorpublic void buildFinish(NetcdfFile ncfile)
IOServiceProvider
buildFinish
in interface IOServiceProvider
public void close() throws java.io.IOException
IOServiceProvider
close
in interface IOServiceProvider
java.io.IOException
- if read errorpublic java.lang.String getDetailInfo()
IOServiceProvider
getDetailInfo
in interface IOServiceProvider
public java.lang.String getFileTypeVersion()
IOServiceProvider
getFileTypeVersion
in interface IOServiceProvider
public long getLastModified()
FileFactory
.long
value representing the time the file(s) were last modified or 0L
if the
last-modified time couldn't be determined for any reason.public StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws java.io.IOException
IOServiceProvider
getStructureIterator
in interface IOServiceProvider
s
- the StructurebufferSize
- the buffersizejava.io.IOException
- if problem reading datapublic boolean isBuilder()
IOServiceProvider
isBuilder
in interface IOServiceProvider
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws java.io.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.java.io.IOException
- if read errorpublic void reacquire() throws java.io.IOException
IOServiceProvider
reacquire
in interface IOServiceProvider
java.io.IOException
public Array readSection(ParsedSectionSpec cer) throws java.io.IOException, InvalidRangeException
IOServiceProvider
readSection
in interface IOServiceProvider
cer
- section specification : what data is wantedjava.io.IOException
- on read errorInvalidRangeException
- if section spec is invalidpublic long readToByteChannel(Variable v2, Section section, java.nio.channels.WritableByteChannel channel) throws java.io.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 WritableByteChanneljava.io.IOException
- if read errorInvalidRangeException
- if invalid sectionpublic long readToOutputStream(Variable v2, Section section, java.io.OutputStream out) throws java.io.IOException, InvalidRangeException
IOServiceProvider
readToOutputStream
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.out
- write data to this OutputStreamjava.io.IOException
- if read errorInvalidRangeException
- if invalid sectionpublic void release() throws java.io.IOException
IOServiceProvider
release
in interface IOServiceProvider
java.io.IOException
@Nullable public java.lang.Object sendIospMessage(@Nullable java.lang.Object message)
IOServiceProvider
sendIospMessage
in interface IOServiceProvider
message
- opaque message sent to the IOSP object when its opened (not when isValidFile() is called)public void setNetcdfFile(NetcdfFile ncfile)
public long streamToByteChannel(Variable v2, Section section, java.nio.channels.WritableByteChannel channel) throws java.io.IOException, InvalidRangeException
streamToByteChannel
in interface IOServiceProvider
java.io.IOException
InvalidRangeException
public boolean syncExtend() throws java.io.IOException
IOServiceProvider
syncExtend
in interface IOServiceProvider
java.io.IOException
- if a read error occured when accessing the underlying dataset.public java.lang.String toStringDebug(java.lang.Object o)
IOServiceProvider
toStringDebug
in interface IOServiceProvider
o
- which object