Package org.geotools.imageio.netcdf
Class NetCDFUnitFormat
- Object
-
- BaseUnitFormatter
-
- NetCDFUnitFormat
-
- All Implemented Interfaces:
UnitFormatter
public final class NetCDFUnitFormat extends BaseUnitFormatter
Parser/Encoder for units expressed in the NetCDF CF syntax, with ability to configure the unit syntax transformation and allow setting up custom aliases just for the NetCDF case.
-
-
Field Summary
Fields Modifier and Type Field Description static StringNETCDF_UNIT_ALIASESUnit aliases config file name (normally looked up in the classpath)static StringNETCDF_UNIT_REPLACEMENTSUnit replacements config file name (normally looked up in the classpath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Map<String,String>builtInAliases()static Map<String,String>builtInReplacements()static NetCDFUnitFormatcreate(Map<String,String> replacements, Map<String,String> aliases)static NetCDFUnitFormatcreateWithBuiltInConfig()Creates a NetCDFUnitFormat with the built-in defaults.static NetCDFUnitFormatgetInstance()static LinkedHashMap<String,String>loadPropertiesOrdered(InputStream is)Loads a properties file preserving its internal orderUnit<?>parse(String spec)Parses a unit applying the configured set of replacements and aliasesvoidsetAliases(Map<String,String> aliases)Configures the aliases to be used on the unit parser.voidsetReplacements(Map<String,String> replacements)Configures the string replacements to be performed before trying to parse the units.-
Methods inherited from class BaseUnitFormatter
addAlias, addLabel, format, isUnitIdentifierPart, isValidIdentifier, nameFor, parse, parse, parseObject, parseProductUnit, parseSingleUnit, prefixFor, toString
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface UnitFormatter
format
-
-
-
-
Field Detail
-
NETCDF_UNIT_ALIASES
public static final String NETCDF_UNIT_ALIASES
Unit aliases config file name (normally looked up in the classpath)- See Also:
- Constant Field Values
-
NETCDF_UNIT_REPLACEMENTS
public static final String NETCDF_UNIT_REPLACEMENTS
Unit replacements config file name (normally looked up in the classpath)- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static NetCDFUnitFormat getInstance()
-
createWithBuiltInConfig
public static NetCDFUnitFormat createWithBuiltInConfig()
Creates a NetCDFUnitFormat with the built-in defaults.
-
create
public static NetCDFUnitFormat create(Map<String,String> replacements, Map<String,String> aliases)
-
loadPropertiesOrdered
public static LinkedHashMap<String,String> loadPropertiesOrdered(InputStream is)
Loads a properties file preserving its internal order- Parameters:
is- The input stream to be read- Returns:
- The contents as a
LinkedHashMappreserving the file contents
-
setReplacements
public void setReplacements(Map<String,String> replacements)
Configures the string replacements to be performed before trying to parse the units.- Parameters:
replacements- The replacements to be used. It is strongly advised to use aLinkedHashMapas replacements are run from top to bottom, in order, and the order might influence the results
-
setAliases
public void setAliases(Map<String,String> aliases)
Configures the aliases to be used on the unit parser. An alias is a different name for a unit.
-
parse
public Unit<?> parse(String spec)
Parses a unit applying the configured set of replacements and aliases
-
-