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

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






NexusFile (h5jan API)












org.eclipse.dawnsci.nexus

Interface NexusFile

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    NexusFileHDF5


    public interface NexusFile
    extends java.lang.AutoCloseable
    Replacement for old Nexus file interface All elements of a path can be augmented with an optional NX_class string appended on with a ":". If the NX_class attribute does not match then an IllegalArgumentException will be thrown.
    • Method Summary

      All Methods Instance Methods Abstract 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 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
      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 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 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
      int flush()
      Flush data to filesystem
      void flushAllCachedDatasets()
      Flush datasets cached when setCacheDataset(boolean) is set true
      java.lang.String getAttributeValue(java.lang.String path)
      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 path, boolean createPathIfNecessary)
      Get group with given path and create path if necessary
      Node getNode(java.lang.String path)
      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.
      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 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
    • Method Detail

      • getFilePath

        java.lang.String getFilePath()
        Returns the file path of this NexusFile
        Returns:
        file path
      • openToWrite

        void openToWrite(boolean createIfNecessary)
                  throws NexusException
        Open file to write
        Parameters:
        createIfNecessary - if true, then create file if it does not exist
        Throws:
        java.io.IOException
        NexusException
      • createAndOpenToWrite

        void createAndOpenToWrite()
                           throws NexusException
        Create file and open to write
        Throws:
        java.io.IOException
        NexusException
      • setWritesAsync

        void setWritesAsync(boolean async)
        Set to writes to be performed asynchronously for data nodes created after calling this
        Parameters:
        async -
      • setCacheDataset

        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 flushAllCachedDatasets() to flush
        Parameters:
        cacheDataset -
      • setDebug

        void setDebug(boolean debug)
        Set to instrument some method calls via logging at the DEBUG level
        Parameters:
        debug -
      • getRoot

        java.lang.String getRoot()
        Get the path of root node from internal tree
        Returns:
        root node path
      • getPath

        java.lang.String getPath(Node node)
        Get path of node from internal tree
        Parameters:
        node -
        Returns:
        (depth-first) path of node
      • getGroup

        GroupNode getGroup(java.lang.String path,
                           boolean createPathIfNecessary)
                    throws NexusException
        Get group with given path and create path if necessary
        Parameters:
        path -
        createPathIfNecessary -
        Returns:
        node or null if group does not exist at specified path
        Throws:
        NexusException
      • getGroup

        GroupNode getGroup(GroupNode group,
                           java.lang.String name,
                           java.lang.String nxClass,
                           boolean createPathIfNecessary)
                    throws NexusException
        Get group in group with given name and create path if necessary
        Parameters:
        group -
        name -
        nxClass -
        createPathIfNecessary -
        Returns:
        node or null
        Throws:
        NexusException - if node is not a group at specified path or group does not exist and not creating path
      • getData

        DataNode getData(java.lang.String path)
                  throws NexusException
        Get data node with given path
        Parameters:
        path -
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException
      • getData

        DataNode getData(GroupNode group,
                         java.lang.String name)
                  throws NexusException
        Get data node in group with given name
        Parameters:
        group -
        name -
        Returns:
        node or null if data does not exist in group
        Throws:
        NexusException
      • addNode

        void addNode(java.lang.String path,
                     Node node)
              throws NexusException
        Add node to given path. This will recursively add other nodes if the given node is a group node.
        Parameters:
        path -
        node -
        Throws:
        NexusException - if node already exists at given path or parts of path does not exist
      • addNode

        void addNode(GroupNode group,
                     java.lang.String name,
                     Node node)
              throws NexusException
        Add node to group. This will recursively add other nodes if the given node is a group node.
        Parameters:
        group -
        name -
        node -
        Throws:
        NexusException - if node already exists in group with name
      • removeNode

        void removeNode(java.lang.String path,
                        java.lang.String name)
                 throws NexusException
        Remove node from given path.

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

        Parameters:
        path - path to parent group of node
        name - name of node in parent group
        Throws:
        NexusException
      • removeNode

        void removeNode(GroupNode group,
                        java.lang.String name)
                 throws NexusException
        Remove node from given group.

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

        Parameters:
        group - parent group of node
        name - name of node in parent group
        Throws:
        NexusException
      • createData

        DataNode createData(java.lang.String path,
                            ILazyWriteableDataset data,
                            boolean createPathIfNecessary)
                     throws NexusException
        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.
        Parameters:
        path - to group
        data -
        createPathIfNecessary -
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

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

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

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

        DataNode createData(java.lang.String path,
                            IDataset data,
                            boolean createPathIfNecessary)
                     throws NexusException
        Create data node with given path to its group and create path if necessary
        Parameters:
        path - to group
        data - dataset
        createPathIfNecessary -
        Returns:
        node or null if data does not exist at specified path
        Throws:
        NexusException - when node already exists
      • createData

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

        DataNode createData(GroupNode group,
                            ILazyWriteableDataset data)
                     throws NexusException
        Create data node in given group
        Parameters:
        group - parent group
        data - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

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

        DataNode createData(GroupNode group,
                            ILazyWriteableDataset data,
                            int compression)
                     throws NexusException
        Create data node in given group
        Parameters:
        group -
        data -
        compression -
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

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

        DataNode createData(GroupNode group,
                            IDataset data)
                     throws NexusException
        Create data node in given group
        Parameters:
        group - parent group
        data - dataset
        Returns:
        node
        Throws:
        NexusException - when node already exists
      • createData

        DataNode createData(GroupNode group,
                            java.lang.String name,
                            IDataset data)
                     throws NexusException
        Create data node with given name in given group
        Parameters:
        group - parent group
        name - name within group
        data - dataset
        Returns:
        Throws:
        NexusException
      • createAttribute

        Attribute createAttribute(IDataset attr)
        Create attribute
        Parameters:
        attr -
        Returns:
        attribute
      • getAttributeValue

        java.lang.String getAttributeValue(java.lang.String path)
                                    throws NexusException
        The full attribute key is: @ e.g. /entry1/data@napimount
        Parameters:
        fullAttributeKey -
        Returns:
        Throws:
        NexusException
      • addAttribute

        void addAttribute(java.lang.String path,
                          Attribute... attribute)
                   throws NexusException
        Add (and write) attribute(s) to given path
        Parameters:
        path -
        attribute -
        Throws:
        NexusException
      • link

        void link(java.lang.String source,
                  java.lang.String destination)
           throws NexusException
        Link source to a destination. If the destination ends in then the source name is added to the destination.
        Parameters:
        source -
        destination -
        Throws:
        NexusException
      • linkExternal

        void linkExternal(java.net.URI source,
                          java.lang.String destination,
                          boolean isGroup)
                   throws NexusException
        Link source in another file to a destination. If the destination ends in then the source name is added to the destination.
        Parameters:
        source -
        destination -
        isGroup -
        Throws:
        NexusException
      • flush

        int flush()
           throws NexusException
        Flush data to filesystem
        Returns:
        the nexus int code for the flush or -1 if unsucessfull.
        Throws:
        NexusException
      • isPathValid

        boolean isPathValid(java.lang.String path)
        Checks if a path within the file exists
        Parameters:
        path -
        Returns:
        true if path exists
      • activateSwmrMode

        void activateSwmrMode()
                       throws NexusException
        Activates SWMR mode. The file must have been created as with SWMR enabled.
        Throws:
        NexusException - if SWMR mode could not be activated
      • getNode

        Node getNode(java.lang.String path)
              throws NexusException
        Get Node with given path. Can be a GroupNode or a DataNode
        Parameters:
        path -
        Returns:
        node or null if group does not exist at specified path
        Throws:
        NexusException




© 2015 - 2024 Weber Informatics LLC | Privacy Policy