public class DirectoryCollection extends CollectionAbstract
| Modifier and Type | Class and Description |
|---|---|
static interface |
DirectoryCollection.Visitor |
CollectionAbstract.DateSorter, CollectionAbstract.MyGribFilterauxInfo, CATALOG, collectionName, dateExtractor, DIR, FILE, filter, GLOB, lastModified, LIST, logger, NCX_SUFFIX, protoChoice, root, sfilter, startCollection| Constructor and Description |
|---|
DirectoryCollection(String topCollectionName,
Path topDir,
org.slf4j.Logger logger) |
DirectoryCollection(String topCollectionName,
String topDirS,
org.slf4j.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close and release any resources.
|
CloseableIterator<MFile> |
getFileIterator()
Get the current collection of MFile, no guaranteed order.
|
Iterable<MFile> |
getFilesSorted()
Get the current collection of MFile.
|
String |
getIndexFilename() |
Path |
getIndexPath() |
String |
getRoot()
Get common root directory of all MFiles in the collection - may be null
|
boolean |
isLeafDirectory() |
void |
iterateOverMFileCollection(DirectoryCollection.Visitor visit) |
static Path |
makeCollectionIndexPath(String topCollectionName,
Path dir)
Create standard name = topCollectionName + last directory
|
static String |
makeCollectionName(String topCollectionName,
Path dir)
Create standard name = topCollectionName + last directory
|
cleanName, extractDate, getAuxInfo, getCollectionName, getFilenames, getLastModified, getLatestFile, getProtoIndex, getStartCollection, hasDateExtractor, isLeaf, makeFileListSorted, open, putAuxInfo, setDateExtractor, setLeaf, setMFileFilter, setRoot, setStreamFilterpublic DirectoryCollection(String topCollectionName, Path topDir, org.slf4j.Logger logger)
public static String makeCollectionName(String topCollectionName, Path dir)
topCollectionName - from config, name of the collectiondir - directory for thispublic static Path makeCollectionIndexPath(String topCollectionName, Path dir)
topCollectionName - from config, name of the collectiondir - directory for thispublic Path getIndexPath()
public boolean isLeafDirectory()
throws IOException
IOExceptionpublic String getRoot()
MCollectiongetRoot in interface MCollectiongetRoot in class CollectionAbstractpublic String getIndexFilename()
getIndexFilename in interface MCollectiongetIndexFilename in class CollectionAbstractpublic Iterable<MFile> getFilesSorted() throws IOException
MCollectionIOExceptionpublic CloseableIterator<MFile> getFileIterator() throws IOException
MCollection
try (CloseableIterator iter = getFileIterator()) {
while (iter.hasNext()) {
MFile file = iter.next();
}
}
IOExceptionpublic void close()
MCollectionpublic void iterateOverMFileCollection(DirectoryCollection.Visitor visit) throws IOException
IOExceptionCopyright © 1999–2014 UCAR/Unidata. All rights reserved.