Package ucar.nc2.internal.iosp.hdf5
Class H5iospNew
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.internal.iosp.hdf5.H5iospNew
-
- All Implemented Interfaces:
IOServiceProvider
public class H5iospNew extends AbstractIOServiceProvider
HDF5 I/O
-
-
Field Summary
Fields Modifier and Type Field Description static StringIOSP_MESSAGE_INCLUDE_ORIGINAL_ATTRIBUTESstatic intVLEN_T_SIZE-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, ncfile, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description H5iospNew()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(RandomAccessFile raf, Group.Builder rootGroup, CancelTask cancelTask)Open existing file, and populate it.voidclose()Close the file.StringgetFileTypeDescription()Get a human-readable description for this file type.StringgetFileTypeId()Get a unique id for this file type.H5headerNewgetHeader()protected Optional<Charset>getValueCharset()Returnvalue charsetif it was defined.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.voidreacquire()Reacquire any resources like file handles Used when reactivating in cache.ArrayreadData(Variable v2, Section section)Read data from a top level Variable and return a memory resident Array.ObjectsendIospMessage(Object message)A way to communicate arbitrary information to and from an iosp.static voidsetDebugFlags(DebugFlags debugFlag)protected voidsetValueCharset(Charset charset)Definevalue charset.StringtoStringDebug(Object o)Debug info for this object.static voiduseHdfEos(boolean val)-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
buildFinish, getDetailInfo, getFileTypeVersion, getLastModified, getStructureIterator, readSection, readToByteChannel, readToOutputStream, release, setNetcdfFile, streamToByteChannel, syncExtend
-
-
-
-
Field Detail
-
IOSP_MESSAGE_INCLUDE_ORIGINAL_ATTRIBUTES
public static final String IOSP_MESSAGE_INCLUDE_ORIGINAL_ATTRIBUTES
- See Also:
- Constant Field Values
-
VLEN_T_SIZE
public static final int VLEN_T_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDebugFlags
public static void setDebugFlags(DebugFlags debugFlag)
-
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"
-
useHdfEos
public static void useHdfEos(boolean val)
-
isBuilder
public boolean isBuilder()
Description copied from interface:IOServiceProviderIf this iosp implements build().- Specified by:
isBuilderin interfaceIOServiceProvider- Overrides:
isBuilderin classAbstractIOServiceProvider
-
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
-
sendIospMessage
public Object sendIospMessage(Object message)
Description copied from interface:IOServiceProviderA way to communicate arbitrary information to and from an iosp.- Specified by:
sendIospMessagein interfaceIOServiceProvider- Overrides:
sendIospMessagein classAbstractIOServiceProvider- Parameters:
message- opaque message sent to the IOSP object when its opened (not when isValidFile() is called)- Returns:
- opaque Object, may be null.
-
getValueCharset
protected Optional<Charset> getValueCharset()
Returnvalue charsetif it was defined. Definition of charset occurs by sending a charset as a message using thesendIospMessage(java.lang.Object)method.- Returns:
value charsetif it was defined.
-
setValueCharset
protected void setValueCharset(@Nullable Charset charset)Definevalue charset.- Parameters:
charset- may be null.
-
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
-
getHeader
public H5headerNew getHeader()
-
readData
public Array readData(Variable v2, 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:
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.- Returns:
- the requested data in a memory-resident Array
- Throws:
IOException- if read errorInvalidRangeException- if invalid section- See Also:
Range
-
close
public void close() throws IOExceptionDescription copied from interface:IOServiceProviderClose 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:
closein interfaceIOServiceProvider- Overrides:
closein classAbstractIOServiceProvider- Throws:
IOException- if read error
-
reacquire
public void reacquire() throws IOExceptionDescription copied from interface:IOServiceProviderReacquire any resources like file handles Used when reactivating in cache.- Specified by:
reacquirein interfaceIOServiceProvider- Overrides:
reacquirein classAbstractIOServiceProvider- Throws:
IOException
-
toStringDebug
public String toStringDebug(Object o)
Description copied from interface:IOServiceProviderDebug info for this object.- Specified by:
toStringDebugin interfaceIOServiceProvider- Overrides:
toStringDebugin classAbstractIOServiceProvider- Parameters:
o- which object- Returns:
- debug info for this object
-
-