waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapEDUnits.java
public static HashMap<String, String> getHashMapStringString(InputStream inputStream, String charset)
            throws IOException {
        HashMap<String, String> ht = new HashMap<>();
        ErddapStringArray sa = ErddapStringArray.fromInputStream(inputStream, charset);
        int n = sa.size();
        int i = 0;
        while (i < n) {
            String s = sa.get(i++);
            if (s.startsWith("#")) {
                continue;
            }
            while (i < n && s.endsWith("\\")) {
                s = s.substring(0, s.length() - 1) + sa.get(i++);
            }
            int po = s.indexOf('=');
            if (po < 0) {
                continue;
            }
            //new String: so not linked to big source file's text
            ht.put(s.substring(0, po).trim(), s.substring(po + 1).trim());
        }
        return ht;
    }
public static HashMap<String, String> getHashMapStringString(InputStream inputStream, String charset)
            throws IOException {
        HashMap<String, String> ht = new HashMap<>();
        ErddapStringArray sa = ErddapStringArray.fromInputStream(inputStream, charset);
        int n = sa.size();
        int i = 0;
        while (i < n) {
            String s = sa.get(i++);
            if (s.startsWith("#")) {
                continue;
            }
            while (i < n && s.endsWith("\\")) {
                s = s.substring(0, s.length() - 1) + sa.get(i++);
            }
            int po = s.indexOf('=');
            if (po < 0) {
                continue;
            }
            //new String: so not linked to big source file's text
            ht.put(s.substring(0, po).trim(), s.substring(po + 1).trim());
        }
        return ht;
    }
public static HashMap < String , String > getHashMapStringString ( InputStream inputStream , String charset ) throws IOException { HashMap < String , String > ht = new HashMap <> ( ) ; ErddapStringArray sa = ErddapStringArray . fromInputStream ( inputStream , charset ) ; int n = sa . size ( ) ; int i = 0 ; while ( i < n ) { String s = sa . get ( i ++ ) ; if ( s . startsWith ( "#" ) ) { continue ; } while ( i < n && s . endsWith ( "\\" ) ) { s = s . substring ( 0 , s . length ( ) - 1 ) + sa . get ( i ++ ) ; } int po = s . indexOf ( ' ' ) ; if ( po < 0 ) { continue ; } //new String: so not linked to big source file's text ht . put ( s . substring ( 0 , po ) . trim ( ) , s . substring ( po + 1 ) . trim ( ) ) ; } return ht ; }
Reads the contents of {@code inputStream} into a HashMap. Each key-value pair in the input will result in an
entry in the map.
<p/>
The specified stream remains open after this method returns.

@param inputStream a stream with line-based, key-value pairs.
@param charset     the name of a supported {@link java.nio.charset.Charset charset}.
@return a HashMap initialized from the stream.
@throws java.io.IOException if an I/O error occurs
Reads the contents of { @code inputStream } into a HashMap . Each key - value pair in the input will result in an entry in the map . <p / > The specified stream remains open after this method returns .