Package pulse.io.readers
Class ReaderManager
- java.lang.Object
-
- pulse.io.readers.ReaderManager
-
public class ReaderManager extends Object
AReaderManageris a single class that manages most input operations.ReaderManagercan dynamically access all available readers using theirReflexiveinterfaces. It can also dynamically assign a file with a recognised format to a specific reader. Note that MetaFilePopulator is not covered by this class, as there is only oneMetadataformat which is internal toPULsE.This class heavily relies on the stream API from the Java SDK.
- See Also:
Reflexive,CurveReader,DatasetReader
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<CurveReader>curveReaders()Finds all classes assignable fromCurveReaderwithin this package.static List<DatasetReader>datasetReaders()Finds all classes assignable fromDatasetReaderwithin this package.static List<CurveReader>findCurveReaders(String pckgname)Finds all classes assignable fromCurveReaderwithin thepckgnamepackage.static List<DatasetReader>findDatasetReaders(String pckgname)Finds all classes assignable fromDatasetReaderwithin thepckgnamepackage.static List<PulseDataReader>findPulseReaders(String pckgname)static List<String>getCurveExtensions()Returns a list of extensions recognised by the availableCurveReaders.static List<String>getDatasetExtensions()Returns a list of extensions recognised by the availableDatasetReaders.static List<String>getPulseExtensions()static <T> Set<T>load(AbstractReader<T> reader, String location, String listName)This method is specifically introduced to handle multiple files in a resources folder enclosed within thejararchive.static List<PulseDataReader>pulseReaders()static <T> Tread(List<? extends AbstractReader<T>> readers, File file)Attempts to find aDatasetReaderfor processingfile.static <T> Set<T>readDirectory(List<AbstractReader<T>> readers, File directory)Obtains a set of files indirectoryand attemps to convert each file toTusingreaders.static VersionreadVersion()
-
-
-
Method Detail
-
getCurveExtensions
public static List<String> getCurveExtensions()
Returns a list of extensions recognised by the availableCurveReaders.- Returns:
- a
Listof {
-
getDatasetExtensions
public static List<String> getDatasetExtensions()
Returns a list of extensions recognised by the availableDatasetReaders.- Returns:
- a
Listof {
-
findCurveReaders
public static List<CurveReader> findCurveReaders(String pckgname)
Finds all classes assignable fromCurveReaderwithin thepckgnamepackage.- Parameters:
pckgname- the name of the package to conduct search in.- Returns:
- a list of
CurveReaders inpckgname
-
findPulseReaders
public static List<PulseDataReader> findPulseReaders(String pckgname)
-
curveReaders
public static List<CurveReader> curveReaders()
Finds all classes assignable fromCurveReaderwithin this package.- Returns:
- a list of
CurveReaders in this package
-
pulseReaders
public static List<PulseDataReader> pulseReaders()
-
findDatasetReaders
public static List<DatasetReader> findDatasetReaders(String pckgname)
Finds all classes assignable fromDatasetReaderwithin thepckgnamepackage.- Parameters:
pckgname- the name of the package to conduct search in.- Returns:
- a list of
DatasetReaders inpckgname
-
datasetReaders
public static List<DatasetReader> datasetReaders()
Finds all classes assignable fromDatasetReaderwithin this package.- Returns:
- a list of
DatasetReaders in this package
-
read
public static <T> T read(List<? extends AbstractReader<T>> readers, File file)
Attempts to find aDatasetReaderfor processingfile.- Type Parameters:
T-- Parameters:
readers-file- the target file supposedly containing data for anInterpolationDataset.- Returns:
- an
InterpolationDatasetextracted from { - Throws:
IllegalArgumentException- if the file has an unsupported extension
-
readDirectory
public static <T> Set<T> readDirectory(List<AbstractReader<T>> readers, File directory) throws IllegalArgumentException
Obtains a set of files indirectoryand attemps to convert each file toTusingreaders.- Type Parameters:
T- a type recognised byreaders- Parameters:
readers- a list ofAbstractReaders capable of processingTdirectory- a directory- Returns:
- the set of converted
Tobjects - Throws:
IllegalArgumentException- if second argument is not a directory
-
load
public static <T> Set<T> load(AbstractReader<T> reader, String location, String listName)
This method is specifically introduced to handle multiple files in a resources folder enclosed within thejararchive. A list of files is required to be included in the same location, which is scanned and each entry is added to a temporary list of names. A combination of these names with the relativelocationallows reading separate files and collating the result in a uniqueSet.- Type Parameters:
T- a type recognised by thereader- Parameters:
reader- the reader specifically targetted atTlocation- the relative location of fileslistName- the name of the list-file- Returns:
- a unique
SetofT
-
readVersion
public static Version readVersion()
-
-