opendap/src/main/java/opendap/util/iniFile.java
private void parseFile()
    {

        try {
            try (
                BufferedReader fp = new BufferedReader(new InputStreamReader(new FileInputStream(iniFile), Charset.forName("UTF-8")));
            ) {
                boolean done = false;
                while(!done) {
                    String thisLine = fp.readLine();
		            if(thisLine != null && thisLine.trim().length() == 0)
			            thisLine = null;
                    if(thisLine != null) {
                        if(Debug) System.out.println("Read: \"" + thisLine + "\"");

                        if(thisLine.startsWith(";") || thisLine.equalsIgnoreCase("")) {
                            // Do nothing, it's a comment
                            if(Debug) System.out.println("Ignoring comment or blank line...");
                        } else {
                            int cindx = thisLine.indexOf(";");

                            if(cindx > 0)
                                thisLine = thisLine.substring(0, cindx).trim();

                            if(Debug) System.out.println("Comments removed: \"" + thisLine + "\"");


                            if(thisLine.startsWith("[") && thisLine.endsWith("]")) {

                                String sname = thisLine.substring(1, thisLine.length() - 1).trim();

                                if(Debug) System.out.println("Found Section Name: " + sname);

                                if(sectionNames == null)
                                    sectionNames = new Vector();

                                sectionNames.add(sname);

                                if(sectionProperties == null)
                                    sectionProperties = new Vector();

                                sectionProperties.add(new Vector());


                            } else if(sectionNames != null && sectionProperties != null) {
                                int eqidx = thisLine.indexOf("=");

                                if(eqidx != -1) {
                                    String pair[] = new String[2];
                                    pair[0] = thisLine.substring(0, eqidx).trim();
                                    pair[1] = thisLine.substring(eqidx + 1, thisLine.length()).trim();

                                    if(Debug)
                                        System.out.println("pair[0]: \"" + pair[0] + "\"   pair[1]: \"" + pair[1] + "\"");

                                    // Add the pair to the current property list, which is the
                                    // last element in the sectionProperties vector.
                                    ((Vector) sectionProperties.lastElement()).add(pair);
                                }
                            }
                        }
                    } else {
                        done = true;
                    }
                }
            }
        } catch (FileNotFoundException e) {
            System.err.println("Could Not Find ini File: \"" + iniFile + "\"");
        } catch (IOException e) {
            System.err.println("Could Not Read ini File: \"" + iniFile + "\"");
        }
    }
private void parseFile()
    {

        try {
            try (
                BufferedReader fp = new BufferedReader(new InputStreamReader(new FileInputStream(iniFile), Charset.forName("UTF-8")));
            ) {
                boolean done = false;
                while(!done) {
                    String thisLine = fp.readLine();
		            if(thisLine != null && thisLine.trim().length() == 0)
			            thisLine = null;
                    if(thisLine != null) {
                        if(Debug) System.out.println("Read: \"" + thisLine + "\"");

                        if(thisLine.startsWith(";") || thisLine.equalsIgnoreCase("")) {
                            // Do nothing, it's a comment
                            if(Debug) System.out.println("Ignoring comment or blank line...");
                        } else {
                            int cindx = thisLine.indexOf(";");

                            if(cindx > 0)
                                thisLine = thisLine.substring(0, cindx).trim();

                            if(Debug) System.out.println("Comments removed: \"" + thisLine + "\"");


                            if(thisLine.startsWith("[") && thisLine.endsWith("]")) {

                                String sname = thisLine.substring(1, thisLine.length() - 1).trim();

                                if(Debug) System.out.println("Found Section Name: " + sname);

                                if(sectionNames == null)
                                    sectionNames = new Vector();

                                sectionNames.add(sname);

                                if(sectionProperties == null)
                                    sectionProperties = new Vector();

                                sectionProperties.add(new Vector());


                            } else if(sectionNames != null && sectionProperties != null) {
                                int eqidx = thisLine.indexOf("=");

                                if(eqidx != -1) {
                                    String pair[] = new String[2];
                                    pair[0] = thisLine.substring(0, eqidx).trim();
                                    pair[1] = thisLine.substring(eqidx + 1, thisLine.length()).trim();

                                    if(Debug)
                                        System.out.println("pair[0]: \"" + pair[0] + "\"   pair[1]: \"" + pair[1] + "\"");

                                    // Add the pair to the current property list, which is the
                                    // last element in the sectionProperties vector.
                                    ((Vector) sectionProperties.lastElement()).add(pair);
                                }
                            }
                        }
                    } else {
                        done = true;
                    }
                }
            }
        } catch (FileNotFoundException e) {
            System.err.println("Could Not Find ini File: \"" + iniFile + "\"");
        } catch (IOException e) {
            System.err.println("Could Not Read ini File: \"" + iniFile + "\"");
        }
    }
private void parseFile ( ) { try { try ( BufferedReader fp = new BufferedReader ( new InputStreamReader ( new FileInputStream ( iniFile ) , Charset . forName ( "UTF-8" ) ) ) ; ) { boolean done = false ; while ( ! done ) { String thisLine = fp . readLine ( ) ; if ( thisLine != null && thisLine . trim ( ) . length ( ) == 0 ) thisLine = null ; if ( thisLine != null ) { if ( Debug ) System . out . println ( "Read: \"" + thisLine + "\"" ) ; if ( thisLine . startsWith ( ";" ) || thisLine . equalsIgnoreCase ( "" ) ) { // Do nothing, it's a comment if ( Debug ) System . out . println ( "Ignoring comment or blank line..." ) ; } else { int cindx = thisLine . indexOf ( ";" ) ; if ( cindx > 0 ) thisLine = thisLine . substring ( 0 , cindx ) . trim ( ) ; if ( Debug ) System . out . println ( "Comments removed: \"" + thisLine + "\"" ) ; if ( thisLine . startsWith ( "[" ) && thisLine . endsWith ( "]" ) ) { String sname = thisLine . substring ( 1 , thisLine . length ( ) - 1 ) . trim ( ) ; if ( Debug ) System . out . println ( "Found Section Name: " + sname ) ; if ( sectionNames == null ) sectionNames = new Vector ( ) ; sectionNames . add ( sname ) ; if ( sectionProperties == null ) sectionProperties = new Vector ( ) ; sectionProperties . add ( new Vector ( ) ) ; } else if ( sectionNames != null && sectionProperties != null ) { int eqidx = thisLine . indexOf ( "=" ) ; if ( eqidx != - 1 ) { String pair [ ] = new String [ 2 ] ; pair [ 0 ] = thisLine . substring ( 0 , eqidx ) . trim ( ) ; pair [ 1 ] = thisLine . substring ( eqidx + 1 , thisLine . length ( ) ) . trim ( ) ; if ( Debug ) System . out . println ( "pair[0]: \"" + pair [ 0 ] + "\"   pair[1]: \"" + pair [ 1 ] + "\"" ) ; // Add the pair to the current property list, which is the // last element in the sectionProperties vector. ( ( Vector ) sectionProperties . lastElement ( ) ) . add ( pair ) ; } } } } else { done = true ; } } } } catch ( FileNotFoundException e ) { System . err . println ( "Could Not Find ini File: \"" + iniFile + "\"" ) ; } catch ( IOException e ) { System . err . println ( "Could Not Read ini File: \"" + iniFile + "\"" ) ; } }
**********************************************************************
Parse the .ini file indicated by the <code>private String iniFile</code>.
********************************************************************** Parse the . ini file indicated by the <code > private String iniFile< / code > .