Package ucar.nc2.stream
Class NcStreamIosp
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.stream.NcStreamIosp
-
- All Implemented Interfaces:
IOServiceProvider
public class NcStreamIosp extends AbstractIOServiceProvider
IOSP to read an ncStream that has been written to a file. Proof of concept for making ncStream-encoded file into a version of the netcdf format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classNcStreamIosp.NcsMess
-
Field Summary
-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description NcStreamIosp()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask)Open existing file, and populate it.StringgetFileTypeDescription()Get a human-readable description for this file type.StringgetFileTypeId()Get a unique id for this file type.intgetVersion()booleanisBuilder()If this iosp implements build().booleanisValidFile(RandomAccessFile raf)Check if this is a valid file for this IOServiceProvider.voidopen(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)Open existing file, and populate ncfile with it.voidopenDebug(RandomAccessFile raf, NetcdfFile ncfile, List<NcStreamIosp.NcsMess> messages)ArrayreadData(Variable v, Section section)Read data from a top level Variable and return a memory resident Array.-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
buildFinish, close, getDetailInfo, getFileTypeVersion, getLastModified, getStructureIterator, reacquire, readSection, readToByteChannel, readToOutputStream, release, sendIospMessage, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
-
-
-
-
Method Detail
-
isValidFile
public boolean isValidFile(RandomAccessFile raf) throws IOException
Description copied from interface:IOServiceProviderCheck if this is a valid file for this IOServiceProvider. You must make this method thread safe, ie dont keep any state.- Parameters:
raf- RandomAccessFile- Returns:
- true if valid.
- Throws:
IOException- if read error
-
getFileTypeId
public String getFileTypeId()
Description copied from interface:IOServiceProviderGet a unique id for this file type.- Returns:
- registered id of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getFileTypeDescription
public String getFileTypeDescription()
Description copied from interface:IOServiceProviderGet a human-readable description for this file type.- Returns:
- description of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getVersion
public int getVersion()
-
isBuilder
public boolean isBuilder()
Description copied from interface:IOServiceProviderIf this iosp implements build().- Specified by:
isBuilderin interfaceIOServiceProvider- Overrides:
isBuilderin classAbstractIOServiceProvider
-
open
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Description copied from interface:IOServiceProviderOpen existing file, and populate ncfile with it. This method is only called by the NetcdfFile constructor on itself. The provided NetcdfFile object will be empty except for the location String and the IOServiceProvider associated with this NetcdfFile object.- Specified by:
openin interfaceIOServiceProvider- Overrides:
openin classAbstractIOServiceProvider- Parameters:
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.- Throws:
IOException- if read error
-
build
public void build(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask) throws IOException
Description copied from interface:IOServiceProviderOpen existing file, and populate it. Note that you cannot reference the NetcdfFile within this routine. This is the bridge to immutable objects that will be used exclusively in version 6.- Specified by:
buildin interfaceIOServiceProvider- Overrides:
buildin classAbstractIOServiceProvider- Parameters:
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.- Throws:
IOException- if read error
-
readData
public Array readData(Variable v, Section section) throws IOException, InvalidRangeException
Description copied from interface:IOServiceProviderRead 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:
v- 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.- Returns:
- the requested data in a memory-resident Array
- Throws:
IOException- if read errorInvalidRangeException- if invalid section- See Also:
Range
-
openDebug
public void openDebug(RandomAccessFile raf, NetcdfFile ncfile, List<NcStreamIosp.NcsMess> messages) throws IOException
- Throws:
IOException
-
-