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 Hdf5DataAdaptor
adaptorForFile
(File file) Generate an Hdf5DataAdaptor from a File.static Hdf5DataAdaptor
adaptorForUrl
(String urlPath) Generate an Hdf5DataAdaptor from a urlPath.static Hdf5DataAdaptor
adaptorForUrl
(URL url) Generate an Hdf5DataAdaptor from a URL.String[]
return the array of all attributesboolean
booleanValue
(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.double
doubleValue
(String attributeName) double value associated with the specified attributeboolean
hasAttribute
(String attribute) check whether the main node has the specified attributeint
integer value associated with the specified attributelong
long value associated with the specified attributename()
get the tag name for the main nodestatic Hdf5DataAdaptor
Create an empty HDF5 documentvoid
removeChild
(DataAdaptor adaptor) Remove a child adaptorvoid
set the value of the specified attribute to the specified valuevoid
set the value of the specified attribute to the specified valuevoid
Stores the value of the givendouble[]
object in the data adaptor backing store.void
set the value of the specified attribute to the specified valuevoid
set the value of the specified attribute to the specified valuevoid
set the value of the specified attribute to the specified valuevoid
set the value of the specified attribute to the specified valuestringValue
(String attributeName) string value associated with the specified attributevoid
writeNode
(DataListener listener) write the listener as a new node and append it to the data treevoid
writeNodes
(Collection<? extends DataListener> nodes) Write the collection of listeners to new nodes and append them to the data tree.void
Convenience method for writing a DataAdaptor to a filevoid
writeToUrl
(URL url) Write DataAdaptor to the specified urlvoid
writeToUrlSpec
(String urlSpec) Write DataAdaptor to the specified url
-
Method Details
-
name
get the tag name for the main node- Specified by:
name
in interfaceDataAdaptor
- Returns:
-
hasAttribute
check whether the main node has the specified attribute- Specified by:
hasAttribute
in interfaceDataAdaptor
- Parameters:
attribute
- Name of the attribute to find.- Returns:
- Boolean specifying if the attribute exists.
-
stringValue
Description copied from interface:DataAdaptor
string value associated with the specified attribute- Specified by:
stringValue
in interfaceDataAdaptor
-
doubleValue
Description copied from interface:DataAdaptor
double value associated with the specified attribute- Specified by:
doubleValue
in interfaceDataAdaptor
-
longValue
Description copied from interface:DataAdaptor
long value associated with the specified attribute- Specified by:
longValue
in interfaceDataAdaptor
-
intValue
Description copied from interface:DataAdaptor
integer value associated with the specified attribute- Specified by:
intValue
in interfaceDataAdaptor
-
booleanValue
Description copied from interface:DataAdaptor
boolean value associated with the specified attribute- Specified by:
booleanValue
in interfaceDataAdaptor
-
doubleArray
Description copied from interface:DataAdaptor
Returns the value of an attribute as an array of doubles.- Specified by:
doubleArray
in interfaceDataAdaptor
- Parameters:
attributeName
- the attribute name- Returns:
- Array of double values, a
null
value is returned if the value string is empty.
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
set the value of the specified attribute to the specified value- Specified by:
setValue
in interfaceDataAdaptor
-
setValue
Description copied from interface:DataAdaptor
Stores the value of the givendouble[]
object in the data adaptor backing store.- Specified by:
setValue
in interfaceDataAdaptor
- Parameters:
attributeName
- attribute namearray
- attribute value
-
attributes
Description copied from interface:DataAdaptor
return the array of all attributes- Specified by:
attributes
in interfaceDataAdaptor
-
childAdaptors
Description copied from interface:DataAdaptor
return all child adaptors- Specified by:
childAdaptors
in 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:
childAdaptors
in interfaceDataAdaptor
- Parameters:
label
- the label for which to match the node's tag- Returns:
- a list of child adaptors
-
childAdaptor
Description copied from interface:DataAdaptor
Convenience method to get a single child adaptor when only one is expected- Specified by:
childAdaptor
in interfaceDataAdaptor
-
createChild
Description copied from interface:DataAdaptor
Create an new empty child adaptor with label- Specified by:
createChild
in interfaceDataAdaptor
-
removeChild
Description copied from interface:DataAdaptor
Remove a child adaptor- Specified by:
removeChild
in interfaceDataAdaptor
-
writeNode
Description copied from interface:DataAdaptor
write the listener as a new node and append it to the data tree- Specified by:
writeNode
in interfaceDataAdaptor
-
writeNodes
Description copied from interface:DataAdaptor
Write the collection of listeners to new nodes and append them to the data tree.- Specified by:
writeNodes
in interfaceDataAdaptor
- Parameters:
nodes
- the nodes to write
-
writeTo
Description copied from interface:FileDataAdaptor
Convenience method for writing a DataAdaptor to a file- Specified by:
writeTo
in interfaceFileDataAdaptor
- Throws:
IOException
-
writeToUrl
Description copied from interface:FileDataAdaptor
Write DataAdaptor to the specified url- Specified by:
writeToUrl
in interfaceFileDataAdaptor
- Throws:
IOException
-
writeToUrlSpec
Description copied from interface:FileDataAdaptor
Write DataAdaptor to the specified url- Specified by:
writeToUrlSpec
in 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.
-