public void load ( InputStream in ) throws IOException { BufferedReader input = IOUtil . toBufferedReader ( new InputStreamReader ( in ) ) ; String read ; Map section = null ; String sectionName ; while ( ( read = input . readLine ( ) ) != null ) { if ( read . startsWith ( ";" ) || read . startsWith ( "#" ) ) { continue ; } else if ( read . startsWith ( "[" ) ) { // new section sectionName = read . substring ( 1 , read . indexOf ( "]" ) ) . trim ( ) . toLowerCase ( ) ; section = getSectionEL ( sectionName ) ; if ( section == null ) { section = newMap ( ) ; sections . put ( sectionName , section ) ; } } else if ( read . indexOf ( "=" ) != - 1 && section != null ) { // new key String key = read . substring ( 0 , read . indexOf ( "=" ) ) . trim ( ) . toLowerCase ( ) ; String value = read . substring ( read . indexOf ( "=" ) + 1 ) . trim ( ) ; section . put ( key , value ) ; } } }
loads the ini file