Package noaa.coastwatch.io
Class EarthDataReaderFactory
java.lang.Object
noaa.coastwatch.io.EarthDataReaderFactory
The earth data reader factory class creates an appropriate
earth data reader object based on a file name. The default
list of readers is as follows:
- HDF formats:
- NOAA 1b formats:
- NetCDF formats:
addReader() method, or by adding the class name
to the reader.properties resource file.- Since:
- 3.1.0
- Author:
- Peter Hollemans
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a new reader to the list.static EarthDataReaderCreates an earth data reader object.static voidsetVerbose(boolean flag) Sets the verbose mode.
-
Constructor Details
-
EarthDataReaderFactory
public EarthDataReaderFactory()
-
-
Method Details
-
addReader
Adds a new reader to the list. When the factory creates a new reader from a file name, the new reader will be among those tried when opening the file. The reader should throw ajava.io.IOExceptionif an error is encountered reading the initial parts of the file, and/or if the file format is not recognized. By convention, the reader should have a constructor that takes a singleStringparameter as the file name.- Parameters:
readerClass- the new reader class to add to the list.
-
setVerbose
public static void setVerbose(boolean flag) Sets the verbose mode. If verbose mode is on, the errors encountered while trying to create the reader object are printed.- Parameters:
flag- the verbose flag.
-
create
Creates an earth data reader object.- Parameters:
file- the file name. The file will be opened using the different earth data reader classes in the list until the correct constructor is found.- Returns:
- an earth data reader object specific to the file format.
- Throws:
IOException- if the reader could not be created. Either the file was not found, or the format was not recognized by any reader.
-