Package ucar.nc2.iosp
Class AbstractIOServiceProvider
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IOServiceProvider
public abstract class AbstractIOServiceProvider extends Object implements IOServiceProvider
Abstract base class for IOSP implementations.
-
-
Constructor Summary
Constructors Constructor Description AbstractIOServiceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildFinish(NetcdfFile ncfile)
Sometimes the builder needs access to the finished objects.void
close()
Close the file.String
getDetailInfo()
Show debug / underlying implementation detailsString
getFileTypeVersion()
Get the version of this file type.long
getLastModified()
Returns the time that the underlying file(s) were last modified.Iterator<StructureData>
getSequenceIterator(Sequence s, int bufferSize)
Get the structure iterator.void
reacquire()
Reacquire any resources like file handles Used when reactivating in cache.void
release()
Release any system resources like file handles.Object
sendIospMessage(Object message)
A way to communicate arbitrary information to and from an iosp.void
setRaf(RandomAccessFile raf)
String
toStringDebug(Object o)
Debug info for this object.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
build, getFileTypeDescription, getFileTypeId, isValidFile, readArrayData
-
-
-
-
Method Detail
-
setRaf
public void setRaf(RandomAccessFile raf)
-
buildFinish
public void buildFinish(NetcdfFile ncfile)
Description copied from interface:IOServiceProvider
Sometimes the builder needs access to the finished objects. This is called when ncfile is finished being built.- Specified by:
buildFinish
in interfaceIOServiceProvider
-
close
public void close() throws 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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceIOServiceProvider
- Throws:
IOException
- if read error
-
release
public void release() throws IOException
Description copied from interface:IOServiceProvider
Release any system resources like file handles. Optional, implement only if you are able to reacquire. Used when object is made inactive in cache.- Specified by:
release
in interfaceIOServiceProvider
- Throws:
IOException
-
reacquire
public void reacquire() throws IOException
Description copied from interface:IOServiceProvider
Reacquire any resources like file handles Used when reactivating in cache.- Specified by:
reacquire
in interfaceIOServiceProvider
- Throws:
IOException
-
getSequenceIterator
public Iterator<StructureData> getSequenceIterator(Sequence s, int bufferSize)
Description copied from interface:IOServiceProvider
Get the structure iterator. Iosps with top level sequences must override.- Specified by:
getSequenceIterator
in interfaceIOServiceProvider
- Parameters:
s
- the StructurebufferSize
- the buffersize, may be -1 for default.- Returns:
- an iterator over the StructureData
-
sendIospMessage
@Nullable public Object sendIospMessage(@Nullable Object message)
Description copied from interface:IOServiceProvider
A way to communicate arbitrary information to and from an iosp.- Specified by:
sendIospMessage
in interfaceIOServiceProvider
- Parameters:
message
- opaque message sent to the IOSP object when its opened (not when isValidFile() is called)- Returns:
- opaque Object, may be null.
-
getLastModified
public long getLastModified()
Returns the time that the underlying file(s) were last modified. If they've changed since they were stored in the cache, they will be closed and reopened withFileFactory
.- Specified by:
getLastModified
in interfaceIOServiceProvider
- Returns:
- a
long
value representing the time the file(s) were last modified or0L
if the last-modified time couldn't be determined for any reason.
-
toStringDebug
public String toStringDebug(Object o)
Description copied from interface:IOServiceProvider
Debug info for this object.- Specified by:
toStringDebug
in interfaceIOServiceProvider
- Parameters:
o
- which object- Returns:
- debug info for this object
-
getDetailInfo
public String getDetailInfo()
Description copied from interface:IOServiceProvider
Show debug / underlying implementation details- Specified by:
getDetailInfo
in interfaceIOServiceProvider
- Returns:
- debug info
-
getFileTypeVersion
public String getFileTypeVersion()
Description copied from interface:IOServiceProvider
Get the version of this file type.- Specified by:
getFileTypeVersion
in interfaceIOServiceProvider
- Returns:
- version of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
-