All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generated.docs.javadoc.org.eclipse.dawnsci.hdf5.nexus.NexusFileHDF5.html Maven / Gradle / Ivy






NexusFileHDF5 (h5jan API)












org.eclipse.dawnsci.hdf5.nexus

Class NexusFileHDF5

  • java.lang.Object
    • org.eclipse.dawnsci.hdf5.nexus.NexusFileHDF5
  • All Implemented Interfaces:
    java.lang.AutoCloseable, NexusFile


    public class NexusFileHDF5
    extends java.lang.Object
    implements NexusFile
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  NexusFileHDF5.NodeType 
    • Constructor Summary

      Constructors 
      Constructor and Description
      NexusFileHDF5(java.lang.String path) 
      NexusFileHDF5(java.lang.String path, boolean enableSWMR) 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void activateSwmrMode()
      Activates SWMR mode.
      void addAttribute(Node node, Attribute... attribute)
      Add (and write) attribute(s) to given node
      void addAttribute(java.lang.String path, Attribute... attribute)
      Add (and write) attribute(s) to given path
      void addNode(GroupNode group, java.lang.String name, Node node)
      Add node to group.
      void addNode(java.lang.String path, Node node)
      Add node to given path.
      void close()
      Close file
      void createAndOpenToWrite()
      Create file and open to write
      Attribute createAttribute(IDataset attr)
      Create attribute
      DataNode createData(GroupNode group, IDataset data)
      Create data node in given group
      DataNode createData(GroupNode group, ILazyWriteableDataset data)
      Create data node in given group
      DataNode createData(GroupNode group, ILazyWriteableDataset data, int compression)
      Create data node with given name in given group
      DataNode createData(GroupNode group, java.lang.String name, IDataset data)
      Create data node with given name in given group
      DataNode createData(GroupNode group, java.lang.String name, ILazyWriteableDataset data)
      Create data node with given name in given group
      DataNode createData(GroupNode group, java.lang.String name, ILazyWriteableDataset data, int compression)
      Create data node with given name in given group
      DataNode createData(java.lang.String path, IDataset data, boolean createPathIfNecessary)
      Create data node with given path to its group and create path if necessary The name of the dataset is used as the name of the data node within the parent group.
      DataNode createData(java.lang.String path, ILazyWriteableDataset data, boolean createPathIfNecessary)
      Create data node with given path to its group and create path if necessary The name of the dataset is used as the name of the data node within the parent group.
      DataNode createData(java.lang.String path, ILazyWriteableDataset data, int compression, boolean createPathIfNecessary)
      Create data node with given name and path to its group and create path if necessary.
      DataNode createData(java.lang.String path, java.lang.String name, IDataset data, boolean createPathIfNecessary)
      Create data node with given name and path to its group and create path if necessary.
      DataNode createData(java.lang.String path, java.lang.String name, ILazyWriteableDataset data, boolean createPathIfNecessary)
      Create data node with given name and path to its group and create path if necessary.
      DataNode createData(java.lang.String path, java.lang.String name, ILazyWriteableDataset data, int compression, boolean createPathIfNecessary)
      Create data node with given name and path to its group and create path if necessary
      static NexusFile createNexusFile(java.lang.String path)
      Create a new Nexus file (overwriting any existing one)
      static NexusFile createNexusFile(java.lang.String path, boolean enableSWMR)
      Create a new Nexus file (overwriting any existing one)
      int flush()
      Flush data to filesystem
      void flushAllCachedDatasets()
      Flush datasets cached when NexusFile.setCacheDataset(boolean) is set true
      java.lang.String getAttributeValue(java.lang.String fullAttributeKey)
      The full attribute key is: @ e.g.
      DataNode getData(GroupNode group, java.lang.String name)
      Get data node in group with given name
      DataNode getData(java.lang.String path)
      Get data node with given path
      java.lang.String getFilePath()
      Returns the file path of this NexusFile
      GroupNode getGroup(GroupNode group, java.lang.String name, java.lang.String nxClass, boolean createPathIfNecessary)
      Get group in group with given name and create path if necessary
      GroupNode getGroup(java.lang.String augmentedPath, boolean createPathIfNecessary)
      Get group with given path and create path if necessary
      Node getNode(java.lang.String augmentedPath)
      Get Node with given path.
      java.lang.String getPath(Node node)
      Get path of node from internal tree
      java.lang.String getRoot()
      Get the path of root node from internal tree
      Tree getTree()
      Get the complete tree of data.
      boolean isPathValid(java.lang.String path)
      Checks if a path within the file exists
      void link(java.lang.String source, java.lang.String destination)
      Link source to a destination.
      void linkExternal(java.net.URI source, java.lang.String destination, boolean isGroup)
      Link source in another file to a destination.
      static NexusFile openNexusFile(java.lang.String path)
      Open an existing Nexus file to modify
      static NexusFile openNexusFileReadOnly(java.lang.String path)
      Open an existing Nexus file to read only
      void openToRead()
      Open file to only read
      void openToWrite(boolean createIfNecessary)
      Open file to write
      void removeNode(GroupNode group, java.lang.String name)
      Remove node from given group.
      void removeNode(java.lang.String path, java.lang.String name)
      Remove node from given path.
      void setCacheDataset(boolean cacheDataset)
      Sets the datasets written to to be held open until the file is closed With this value set to true, datasets will not be flushed until the file is closed, call NexusFile.flushAllCachedDatasets() to flush
      void setDebug(boolean debug)
      Set to instrument some method calls via logging at the DEBUG level
      void setWritesAsync(boolean async)
      Set to writes to be performed asynchronously for data nodes created after calling this
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UTF8

        public static final java.nio.charset.Charset UTF8
    • Constructor Detail

      • NexusFileHDF5

        public NexusFileHDF5(java.lang.String path)
      • NexusFileHDF5

        public NexusFileHDF5(java.lang.String path,
                             boolean enableSWMR)
    • Method Detail

      • createNexusFile

        public static NexusFile createNexusFile(java.lang.String path)
                                         throws NexusException
        Create a new Nexus file (overwriting any existing one)
        Parameters:
        path -
        Returns:
        Nexus file
        Throws:
        NexusException
      • createNexusFile

        public static NexusFile createNexusFile(java.lang.String path,
                                                boolean enableSWMR)
                                         throws NexusException
        Create a new Nexus file (overwriting any existing one)
        Parameters:
        path -
        enableSWMR -
        Returns:
        Nexus file
        Throws:
        NexusException
      • openNexusFile

        public static NexusFile openNexusFile(java.lang.String path)
                                       throws NexusException
        Open an existing Nexus file to modify
        Parameters:
        path -
        Returns:
        Nexus file
        Throws:
        NexusException
      • openNexusFileReadOnly

        public static NexusFile openNexusFileReadOnly(java.lang.String path)
                                               throws NexusException
        Open an existing Nexus file to read only
        Parameters:
        path -
        Returns:
        Nexus file
        Throws:
        NexusException
      • getFilePath

        public java.lang.String getFilePath()
        Description copied from interface: NexusFile
        Returns the file path of this NexusFile
        Specified by:
        getFilePath in interface NexusFile
        Returns:
        file path
      • openToWrite

        public void openToWrite(boolean createIfNecessary)
                         throws NexusException
        Description copied from interface: NexusFile
        Open file to write
        Specified by:
        openToWrite in interface NexusFile
        Parameters:
        createIfNecessary - if true, then create file if it does not exist
        Throws:
        NexusException
      • setWritesAsync

        public void setWritesAsync(boolean async)
        Description copied from interface: NexusFile
        Set to writes to be performed asynchronously for data nodes created after calling this
        Specified by:
        setWritesAsync in interface NexusFile
      • setDebug

        public void setDebug(boolean debug)
        Description copied from interface: NexusFile
        Set to instrument some method calls via logging at the DEBUG level
        Specified by:
        setDebug in interface NexusFile
      • getPath

        public java.lang.String getPath(Node node)
        Description copied from interface: NexusFile
        Get path of node from internal tree
        Specified by:
        getPath in interface NexusFile
        Returns:
        (depth-first) path of node
      • getRoot

        public java.lang.String getRoot()
        Description copied from interface: NexusFile
        Get the path of root node from internal tree
        Specified by:
        getRoot in interface NexusFile
        Returns:
        root node path
      • getGroup

        public GroupNode getGroup(java.lang.String augmentedPath,
                                  boolean createPathIfNecessary)
                           throws NexusException
        Description copied from interface: NexusFile
        Get group with given path and create path if necessary
        Specified by:
        getGroup in interface NexusFile
        Returns:
        node or null if group does not exist at specified path
        Throws:
        NexusException
      • getNode

        public Node getNode(java.lang.String augmentedPath)
                     throws NexusException
        Description copied from interface: NexusFile
        Get Node with given path. Can be a GroupNode or a DataNode
        Specified by:
        getNode in interface NexusFile
        Returns:
        node or null if group does not exist at specified path
        Throws:
        NexusException
      • getGroup

        public GroupNode getGroup(GroupNode group,
                                  java.lang.String name,
                                  java.lang.String nxClass,
                                  boolean createPathIfNecessary)
                           throws NexusException
        Description copied from interface: NexusFile
        Get group in group with given name and create path if necessary
        Specified by:
        getGroup in interface NexusFile
        Returns:
        node or null
        Throws:
        NexusException - if node is not a group at specified path or group does not exist and not creating path
      • createData

        public DataNode createData(java.lang.String path,
                                   ILazyWriteableDataset data,
                                   int compression,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name and path to its group and create path if necessary.
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to parent group
        data - name within parent group
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(java.lang.String path,
                                   java.lang.String name,
                                   ILazyWriteableDataset data,
                                   int compression,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name and path to its group and create path if necessary
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to parent group
        name - name within parent group
        data - dataset
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(java.lang.String path,
                                   ILazyWriteableDataset data,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given path to its group and create path if necessary The name of the dataset is used as the name of the data node within the parent group.
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to group
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(java.lang.String path,
                                   java.lang.String name,
                                   ILazyWriteableDataset data,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name and path to its group and create path if necessary.
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to parent group
        name - name within parent group
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(GroupNode group,
                                   ILazyWriteableDataset data,
                                   int compression)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name in given group
        Specified by:
        createData in interface NexusFile
        Parameters:
        group - parent group
        data - name within group
        compression - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(GroupNode group,
                                   java.lang.String name,
                                   ILazyWriteableDataset data,
                                   int compression)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name in given group
        Specified by:
        createData in interface NexusFile
        Parameters:
        group - parent group
        data - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(GroupNode group,
                                   java.lang.String name,
                                   ILazyWriteableDataset data)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name in given group
        Specified by:
        createData in interface NexusFile
        Parameters:
        group - parent group
        name - name within group
        data - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(java.lang.String path,
                                   IDataset data,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given path to its group and create path if necessary The name of the dataset is used as the name of the data node within the parent group.
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to group
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(java.lang.String path,
                                   java.lang.String name,
                                   IDataset data,
                                   boolean createPathIfNecessary)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name and path to its group and create path if necessary.
        Specified by:
        createData in interface NexusFile
        Parameters:
        path - to parent group
        name - name within parent group
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

        public DataNode createData(GroupNode group,
                                   java.lang.String name,
                                   IDataset data)
                            throws NexusException
        Description copied from interface: NexusFile
        Create data node with given name in given group
        Specified by:
        createData in interface NexusFile
        Parameters:
        group - parent group
        name - name within group
        data - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • addNode

        public void addNode(GroupNode group,
                            java.lang.String name,
                            Node node)
                     throws NexusException
        Description copied from interface: NexusFile
        Add node to group. This will recursively add other nodes if the given node is a group node.
        Specified by:
        addNode in interface NexusFile
        Throws:
        NexusException - if node already exists in group with name
      • addNode

        public void addNode(java.lang.String path,
                            Node node)
                     throws NexusException
        Description copied from interface: NexusFile
        Add node to given path. This will recursively add other nodes if the given node is a group node.
        Specified by:
        addNode in interface NexusFile
        Throws:
        NexusException - if node already exists at given path or parts of path does not exist
      • removeNode

        public void removeNode(GroupNode group,
                               java.lang.String name)
                        throws NexusException
        Description copied from interface: NexusFile
        Remove node from given group.

        Note, this will fail if the file is in SWMR node

        Specified by:
        removeNode in interface NexusFile
        Parameters:
        group - parent group of node
        name - name of node in parent group
        Throws:
        NexusException
      • removeNode

        public void removeNode(java.lang.String path,
                               java.lang.String name)
                        throws NexusException
        Description copied from interface: NexusFile
        Remove node from given path.

        Note, this will fail if the file is in SWMR node

        Specified by:
        removeNode in interface NexusFile
        Parameters:
        path - path to parent group of node
        name - name of node in parent group
        Throws:
        NexusException
      • link

        public void link(java.lang.String source,
                         java.lang.String destination)
                  throws NexusException
        Description copied from interface: NexusFile
        Link source to a destination. If the destination ends in then the source name is added to the destination.
        Specified by:
        link in interface NexusFile
        Throws:
        NexusException
      • linkExternal

        public void linkExternal(java.net.URI source,
                                 java.lang.String destination,
                                 boolean isGroup)
                          throws NexusException
        Description copied from interface: NexusFile
        Link source in another file to a destination. If the destination ends in then the source name is added to the destination.
        Specified by:
        linkExternal in interface NexusFile
        Throws:
        NexusException
      • activateSwmrMode

        public void activateSwmrMode()
                              throws NexusException
        Description copied from interface: NexusFile
        Activates SWMR mode. The file must have been created as with SWMR enabled.
        Specified by:
        activateSwmrMode in interface NexusFile
        Throws:
        NexusException - if SWMR mode could not be activated
      • isPathValid

        public boolean isPathValid(java.lang.String path)
        Description copied from interface: NexusFile
        Checks if a path within the file exists
        Specified by:
        isPathValid in interface NexusFile
        Returns:
        true if path exists
      • setCacheDataset

        public void setCacheDataset(boolean cacheDataset)
        Description copied from interface: NexusFile
        Sets the datasets written to to be held open until the file is closed With this value set to true, datasets will not be flushed until the file is closed, call NexusFile.flushAllCachedDatasets() to flush
        Specified by:
        setCacheDataset in interface NexusFile
      • getTree

        public Tree getTree()
        Description copied from interface: NexusFile
        Get the complete tree of data.
        Specified by:
        getTree in interface NexusFile
        Returns:
        tree or null if none exists.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy