Interface IHierarchicalContentNode


  • public interface IHierarchicalContentNode
    Read only abstraction over a node in IHierarchicalContent that provides access to a file and its content.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean exists()
      Returns true if the content node exists.
      java.lang.String getChecksum()
      Returns the checksum of a file abstracted by this node.
      int getChecksumCRC32()
      Returns the CRC32 checksum of a file abstracted by this node.
      java.util.List<IHierarchicalContentNode> getChildNodes()
      List of child nodes of this node.
      java.io.File getFile()
      Returns a file abstracted by this node.
      ch.systemsx.cisd.base.io.IRandomAccessFile getFileContent()
      Returns a read only IRandomAccessFile with file content of the node.
      long getFileLength()
      Returns the length (in bytes) of a file abstracted by this node.
      java.io.InputStream getInputStream()
      Returns an InputStream with content of the node.
      long getLastModified()
      Returns the time this node or the persistent object containing this node has been modified.
      java.lang.String getName()
      Returns name of this node/file.
      java.lang.String getParentRelativePath()
      Returns relative path of this node's parent or null for root node.
      java.lang.String getRelativePath()
      Returns relative path of this node or empty string for root node.
      boolean isChecksumCRC32Precalculated()
      Returns true, if the CRC32 checksum is pre-calculated for this node and false, if it is calculated on demand when calling getChecksumCRC32() or if this node does not have a CRC32 checksum (like e.g.
      boolean isDirectory()
      Returns true if this node is an abstraction of a directory, false otherwise.
      java.io.File tryGetFile()
      Returns a file abstracted by this node, or null, if there is no file that represents this node.
    • Method Detail

      • getName

        java.lang.String getName()
        Returns name of this node/file.
      • getRelativePath

        java.lang.String getRelativePath()
        Returns relative path of this node or empty string for root node.
      • getParentRelativePath

        java.lang.String getParentRelativePath()
        Returns relative path of this node's parent or null for root node.
      • exists

        boolean exists()
        Returns true if the content node exists.
      • isDirectory

        boolean isDirectory()
        Returns true if this node is an abstraction of a directory, false otherwise.
      • getLastModified

        long getLastModified()
        Returns the time this node or the persistent object containing this node has been modified.
        Returns:
        A long value representing the time of last modification, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
      • getChildNodes

        java.util.List<IHierarchicalContentNode> getChildNodes()
                                                        throws java.lang.UnsupportedOperationException
        List of child nodes of this node.

        NOTE: Call isDirectory() first to make sure this node is a directory.

        Throws:
        java.lang.UnsupportedOperationException - if the node is not an abstraction of a directory.
      • getFile

        java.io.File getFile()
                      throws java.lang.UnsupportedOperationException
        Returns a file abstracted by this node.
        Throws:
        java.lang.UnsupportedOperationException - if the backing store is not a normal file/directory.
      • tryGetFile

        java.io.File tryGetFile()
        Returns a file abstracted by this node, or null, if there is no file that represents this node.
      • getFileLength

        long getFileLength()
                    throws java.lang.UnsupportedOperationException
        Returns the length (in bytes) of a file abstracted by this node.

        NOTE: Call isDirectory() first to make sure this node is NOT a directory.

        Throws:
        java.lang.UnsupportedOperationException - if the node is an abstraction of a directory.
      • getChecksumCRC32

        int getChecksumCRC32()
                      throws java.lang.UnsupportedOperationException
        Returns the CRC32 checksum of a file abstracted by this node.

        NOTE: Call isDirectory() first to make sure this node is NOT a directory.

        Throws:
        java.lang.UnsupportedOperationException - if the node is an abstraction of a directory.
      • isChecksumCRC32Precalculated

        boolean isChecksumCRC32Precalculated()
        Returns true, if the CRC32 checksum is pre-calculated for this node and false, if it is calculated on demand when calling getChecksumCRC32() or if this node does not have a CRC32 checksum (like e.g. a directory).
      • getChecksum

        java.lang.String getChecksum()
                              throws java.lang.UnsupportedOperationException
        Returns the checksum of a file abstracted by this node. The returned value is of the form <checksum type>:<checksum>. If it isn't defined a null is returned. It will not be calculated contrary to the behavior of getChecksumCRC32().
        Throws:
        java.lang.UnsupportedOperationException - if the node is an abstraction of a directory.
      • getFileContent

        ch.systemsx.cisd.base.io.IRandomAccessFile getFileContent()
                                                           throws java.lang.UnsupportedOperationException,
                                                                  ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
        Returns a read only IRandomAccessFile with file content of the node. *

        NOTE: Call isDirectory() first to make sure this node is NOT a directory.

        Throws:
        java.lang.UnsupportedOperationException - if the node is an abstraction of a directory.
        ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked - if an I/O error occurs.
      • getInputStream

        java.io.InputStream getInputStream()
                                    throws java.lang.UnsupportedOperationException,
                                           ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
        Returns an InputStream with content of the node.

        NOTE: Call isDirectory() first to make sure this node is NOT a directory.

        Throws:
        java.lang.UnsupportedOperationException - if the node is an abstraction of a directory.
        ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked - if an I/O error occurs.