INSTANCE
- The type of instance in the datasetpublic class VFSGroupDataset<INSTANCE> extends ReadableGroupDataset<String,VFSListDataset<INSTANCE>,INSTANCE,org.apache.commons.vfs2.FileObject> implements Identifiable
GroupedDataset
of VFSListDataset
s backed by directories of
items (either locally or remotely), or items stored in a hierarchical
structure within a compressed archive.
This implementation only supports a basic grouped dataset with String
keys created from the names of directories, and VFSListDataset
values
from all the readable files within each directory.
As an example, this class can be used to easily create a
GroupedDataset
from a directory containing directories of images:
GroupedDataset<String, VFSListDataset<FImage>, FImage> dataset = new VFSGroupDataset<FImage>( "/path/to/directory/of/images", ImageUtilities.FIMAGE_READER);a zip file of directories of images:
GroupedDataset<String, VFSListDataset<FImage>, FImage> dataset = new VFSGroupDataset<FImage>( "zip:file:/path/to/images.zip", ImageUtilities.FIMAGE_READER);or even a remote zip of directories of images hosted via http:
GroupedDataset<String, VFSListDataset<FImage>, FImage> dataset = new VFSGroupDataset<FImage>( "zip:http://localhost/˜jsh2/thumbnails.zip", ImageUtilities.FIMAGE_READER);
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
reader
Constructor and Description |
---|
VFSGroupDataset(String path,
InputStreamObjectReader<INSTANCE> reader)
Construct a grouped dataset from any virtual file system source (local
directory, remote zip file, etc).
|
VFSGroupDataset(String path,
ObjectReader<INSTANCE,org.apache.commons.vfs2.FileObject> reader)
Construct a grouped dataset from any virtual file system source (local
directory, remote zip file, etc).
|
Modifier and Type | Method and Description |
---|---|
Set<Map.Entry<String,VFSListDataset<INSTANCE>>> |
entrySet() |
org.apache.commons.vfs2.FileObject |
getFileObject(String key)
Get the underlying file descriptor for a particular group in the dataset.
|
Map<String,org.apache.commons.vfs2.FileObject> |
getGroupDirectories()
Get the underlying file descriptors of the directories that form the
groups of the dataset
|
String |
getID() |
String |
toString() |
getGroups, getInstances, getRandomInstance, getRandomInstance, iterator, numInstances
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
finalize, getClass, notify, notifyAll, wait, wait, wait
equals
forEach, spliterator
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
public VFSGroupDataset(String path, InputStreamObjectReader<INSTANCE> reader) throws org.apache.commons.vfs2.FileSystemException
path
- the file system path or uri. See the Apache Commons VFS2
documentation for all the details.reader
- the InputStreamObjectReader
that reads the data from
the VFSorg.apache.commons.vfs2.FileSystemException
- if an error occurs accessing the VFSpublic VFSGroupDataset(String path, ObjectReader<INSTANCE,org.apache.commons.vfs2.FileObject> reader) throws org.apache.commons.vfs2.FileSystemException
path
- the file system path or uri. See the Apache Commons VFS2
documentation for all the details.reader
- the InputStreamObjectReader
that reads the data from
the VFSorg.apache.commons.vfs2.FileSystemException
- if an error occurs accessing the VFSpublic Map<String,org.apache.commons.vfs2.FileObject> getGroupDirectories()
public org.apache.commons.vfs2.FileObject getFileObject(String key)
key
- key of the grouppublic String toString()
toString
in class AbstractMap<String,VFSListDataset<INSTANCE>>
public Set<Map.Entry<String,VFSListDataset<INSTANCE>>> entrySet()
entrySet
in interface Map<String,VFSListDataset<INSTANCE>>
entrySet
in class AbstractMap<String,VFSListDataset<INSTANCE>>
public String getID()
getID
in interface Identifiable