Class DirectoryCollection

    • Constructor Detail

      • DirectoryCollection

        public DirectoryCollection​(String topCollectionName,
                                   String topDirS,
                                   boolean isTop,
                                   String olderThan,
                                   org.slf4j.Logger logger)
      • DirectoryCollection

        public DirectoryCollection​(String topCollectionName,
                                   Path collectionDir,
                                   boolean isTop,
                                   String olderThan,
                                   org.slf4j.Logger logger)
    • Method Detail

      • makeCollectionName

        public static String makeCollectionName​(String topCollectionName,
                                                Path dir)
        Create standard name = topCollectionName + last directory
        Parameters:
        topCollectionName - from config, name of the collection
        dir - directory for this
        Returns:
        standard collection name, to name the index file
      • makeCollectionIndexPath

        public static Path makeCollectionIndexPath​(String topCollectionName,
                                                   Path dir,
                                                   String suffix)
        Create standard name = topCollectionName + last directory
        Parameters:
        topCollectionName - from config, name of the collection
        dir - directory for this
        Returns:
        standard collection name, to name the index file
      • getFilesSorted

        public Iterable<MFile> getFilesSorted()
                                       throws IOException
        Description copied from interface: MCollection
        Get the current collection of MFile. if hasDateExtractor() == true, these will be sorted by Date, otherwise by path.
        Returns:
        current collection of MFile as an Iterable.
        Throws:
        IOException
      • getFileIterator

        public CloseableIterator<MFile> getFileIterator()
                                                 throws IOException
        Description copied from interface: MCollection
        Get the current collection of MFile, no guaranteed order. May be faster than getFilesSorted() for large collections, use when order is not important.
         try (CloseableIterator iter = getFileIterator()) {
           while (iter.hasNext()) {
             MFile file = iter.next();
           }
         }
         
        Returns:
        current collection of MFile as an CloseableIterator.
        Throws:
        IOException
      • close

        public void close()
        Description copied from interface: MCollection
        Close and release any resources. Do not make further calls on this object.