Class MCRFileCollection


public class MCRFileCollection extends MCRDirectory
Represents a set of files and directories belonging together, that are stored in a persistent MCRFileStore. A FileCollection has a unique ID within the store, it is the root folder of all files and directories in the collection.
Author:
Frank Lützenkirchen
  • Field Details

  • Constructor Details

    • MCRFileCollection

      protected MCRFileCollection(MCRStore store, int id) throws IOException
      Creates a new file collection in the given store, or retrieves an existing one.
      Parameters:
      store - the store this file collection is stored in
      id - the ID of this file collection
      Throws:
      IOException
      See Also:
  • Method Details

    • saveAdditionalData

      protected void saveAdditionalData() throws IOException
      Throws:
      IOException
    • getChildren

      public Stream<MCRNode> getChildren() throws IOException
      Description copied from class: MCRNode
      Returns the children of this node.
      Overrides:
      getChildren in class MCRNode
      Returns:
      a List of child nodes, which may be empty, in undefined order
      Throws:
      IOException
    • delete

      public void delete() throws IOException
      Deletes this file collection with all its data and children
      Overrides:
      delete in class MCRStoredNode
      Throws:
      IOException
    • renameTo

      public void renameTo(String name)
      Throws a exception, because a file collection's name is always the empty string and therefore can not be renamed.
      Overrides:
      renameTo in class MCRStoredNode
      Parameters:
      name - the new file name
    • getStore

      public MCRStore getStore()
      Returns the store this file collection is stored in.
      Returns:
      the store this file collection is stored in.
    • getID

      public int getID()
      Returns the ID of this file collection
      Returns:
      the ID of this file collection
    • getRoot

      public MCRFileCollection getRoot()
      Returns this object, because the FileCollection instance is the root of all files and directories contained in the collection.
      Overrides:
      getRoot in class MCRNode
      Returns:
      this
    • getChild

      public MCRNode getChild(String name)
      Description copied from class: MCRNode
      Returns the child node with the given filename, or null
      Overrides:
      getChild in class MCRNode
      Parameters:
      name - the name of the child node
      Returns:
      the child node with that name, or null when no such file exists
    • hasChildren

      public boolean hasChildren() throws IOException
      Description copied from class: MCRNode
      Returns true if this node has child nodes. Directories and container files like zip or tar may have child nodes.
      Overrides:
      hasChildren in class MCRNode
      Returns:
      true if children exist
      Throws:
      IOException
    • getNumChildren

      public int getNumChildren() throws IOException
      Description copied from class: MCRNode
      Returns the number of child nodes of this node.
      Overrides:
      getNumChildren in class MCRNode
      Returns:
      the number of child nodes of this node.
      Throws:
      IOException
    • getName

      public String getName()
      Description copied from class: MCRNode
      Returns the file or directory name
      Overrides:
      getName in class MCRNode
      Returns:
      the node's filename
    • repairMetadata

      public void repairMetadata() throws IOException
      Repairs additional metadata stored for all files and directories in this collection
      Throws:
      IOException