thredds.inventory.partition.FilePartition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdm Show documentation
Show all versions of cdm Show documentation
The NetCDF-Java Library is a Java interface to NetCDF files,
as well as to many other types of scientific data formats.
The newest version!
package thredds.inventory.partition;
import thredds.inventory.*;
import ucar.nc2.util.CloseableIterator;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
/**
* A Partition consisting of single files, each is a GribCollection.
* This FilePartition represents the collection of the GribCollections.
* Eg how we store files on motherlode.
*
* @author caron
* @since 12/9/13
*/
public class FilePartition extends DirectoryCollection implements PartitionManager {
public FilePartition(String topCollectionName, Path topDir, String olderThan, org.slf4j.Logger logger) {
super(topCollectionName, topDir, olderThan, logger);
this.collectionName = DirectoryCollection.makeCollectionName(topCollection, topDir);
}
@Override
public Iterable makePartitions(CollectionUpdateType forceCollection) throws IOException {
List result = new ArrayList<>(100);
try (CloseableIterator iter = getFileIterator()) {
while (iter.hasNext()) {
MCollection part = new CollectionSingleFile(iter.next(), logger);
result.add( part);
lastModified = Math.max(lastModified, part.getLastModified());
}
}
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy