Package xal.tools.hdf5
Class Hdf5DataAdaptor
java.lang.Object
xal.tools.hdf5.Hdf5DataAdaptor
- All Implemented Interfaces:
DataAdaptor,FileDataAdaptor
This class creates an HDF5 structure in memory before writing to a file,
since the HDF5 library only supports directly writing to a file.
- Author:
- Juan F. Esteban Müller <JuanF.EstebanMuller@esss.se>
-
Method Summary
Modifier and TypeMethodDescriptionstatic Hdf5DataAdaptoradaptorForFile(File file) Generate an Hdf5DataAdaptor from a File.static Hdf5DataAdaptoradaptorForUrl(String urlPath) Generate an Hdf5DataAdaptor from a urlPath.static Hdf5DataAdaptoradaptorForUrl(URL url) Generate an Hdf5DataAdaptor from a URL.String[]return the array of all attributesbooleanbooleanValue(String attributeName) boolean value associated with the specified attributechildAdaptor(String label) Convenience method to get a single child adaptor when only one is expectedreturn all child adaptorschildAdaptors(String label) Create a list of child adaptors (one adaptor for each non-null child node whose tag name is equal to the specified label).createChild(String tagName) Create an new empty child adaptor with labeldouble[]doubleArray(String attributeName) Returns the value of an attribute as an array of doubles.doubledoubleValue(String attributeName) double value associated with the specified attributebooleanhasAttribute(String attribute) check whether the main node has the specified attributeintinteger value associated with the specified attributelonglong value associated with the specified attributename()get the tag name for the main nodestatic Hdf5DataAdaptorCreate an empty HDF5 documentvoidremoveChild(DataAdaptor adaptor) Remove a child adaptorvoidset the value of the specified attribute to the specified valuevoidset the value of the specified attribute to the specified valuevoidStores the value of the givendouble[]object in the data adaptor backing store.voidset the value of the specified attribute to the specified valuevoidset the value of the specified attribute to the specified valuevoidset the value of the specified attribute to the specified valuevoidset the value of the specified attribute to the specified valuestringValue(String attributeName) string value associated with the specified attributevoidwriteNode(DataListener listener) write the listener as a new node and append it to the data treevoidwriteNodes(Collection<? extends DataListener> nodes) Write the collection of listeners to new nodes and append them to the data tree.voidConvenience method for writing a DataAdaptor to a filevoidwriteToUrl(URL url) Write DataAdaptor to the specified urlvoidwriteToUrlSpec(String urlSpec) Write DataAdaptor to the specified url
-
Method Details
-
name
get the tag name for the main node- Specified by:
namein interfaceDataAdaptor- Returns:
-
hasAttribute
check whether the main node has the specified attribute- Specified by:
hasAttributein interfaceDataAdaptor- Parameters:
attribute- Name of the attribute to find.- Returns:
- Boolean specifying if the attribute exists.
-
stringValue
Description copied from interface:DataAdaptorstring value associated with the specified attribute- Specified by:
stringValuein interfaceDataAdaptor
-
doubleValue
Description copied from interface:DataAdaptordouble value associated with the specified attribute- Specified by:
doubleValuein interfaceDataAdaptor
-
longValue
Description copied from interface:DataAdaptorlong value associated with the specified attribute- Specified by:
longValuein interfaceDataAdaptor
-
intValue
Description copied from interface:DataAdaptorinteger value associated with the specified attribute- Specified by:
intValuein interfaceDataAdaptor
-
booleanValue
Description copied from interface:DataAdaptorboolean value associated with the specified attribute- Specified by:
booleanValuein interfaceDataAdaptor
-
doubleArray
Description copied from interface:DataAdaptorReturns the value of an attribute as an array of doubles.- Specified by:
doubleArrayin interfaceDataAdaptor- Parameters:
attributeName- the attribute name- Returns:
- Array of double values, a
nullvalue is returned if the value string is empty.
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorset the value of the specified attribute to the specified value- Specified by:
setValuein interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptorStores the value of the givendouble[]object in the data adaptor backing store.- Specified by:
setValuein interfaceDataAdaptor- Parameters:
attributeName- attribute namearray- attribute value
-
attributes
Description copied from interface:DataAdaptorreturn the array of all attributes- Specified by:
attributesin interfaceDataAdaptor
-
childAdaptors
Description copied from interface:DataAdaptorreturn all child adaptors- Specified by:
childAdaptorsin interfaceDataAdaptor
-
childAdaptors
Create a list of child adaptors (one adaptor for each non-null child node whose tag name is equal to the specified label).- Specified by:
childAdaptorsin interfaceDataAdaptor- Parameters:
label- the label for which to match the node's tag- Returns:
- a list of child adaptors
-
childAdaptor
Description copied from interface:DataAdaptorConvenience method to get a single child adaptor when only one is expected- Specified by:
childAdaptorin interfaceDataAdaptor
-
createChild
Description copied from interface:DataAdaptorCreate an new empty child adaptor with label- Specified by:
createChildin interfaceDataAdaptor
-
removeChild
Description copied from interface:DataAdaptorRemove a child adaptor- Specified by:
removeChildin interfaceDataAdaptor
-
writeNode
Description copied from interface:DataAdaptorwrite the listener as a new node and append it to the data tree- Specified by:
writeNodein interfaceDataAdaptor
-
writeNodes
Description copied from interface:DataAdaptorWrite the collection of listeners to new nodes and append them to the data tree.- Specified by:
writeNodesin interfaceDataAdaptor- Parameters:
nodes- the nodes to write
-
writeTo
Description copied from interface:FileDataAdaptorConvenience method for writing a DataAdaptor to a file- Specified by:
writeToin interfaceFileDataAdaptor- Throws:
IOException
-
writeToUrl
Description copied from interface:FileDataAdaptorWrite DataAdaptor to the specified url- Specified by:
writeToUrlin interfaceFileDataAdaptor- Throws:
IOException
-
writeToUrlSpec
Description copied from interface:FileDataAdaptorWrite DataAdaptor to the specified url- Specified by:
writeToUrlSpecin interfaceFileDataAdaptor- Throws:
IOException
-
adaptorForUrl
Generate an Hdf5DataAdaptor from a urlPath. -
adaptorForUrl
Generate an Hdf5DataAdaptor from a URL. -
adaptorForFile
Generate an Hdf5DataAdaptor from a File.- Throws:
MalformedURLException
-
newEmptyDocumentAdaptor
Create an empty HDF5 document- Returns:
- DataAdaptor containing the root document node.
-