public static DatabaseFieldConfig fromReader ( BufferedReader reader ) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig ( ) ; boolean anything = false ; while ( true ) { String line ; try { line = reader . readLine ( ) ; } catch ( IOException e ) { throw SqlExceptionUtil . create ( "Could not read DatabaseFieldConfig from stream" , e ) ; } if ( line == null ) { break ; } // we do this so we can support multiple class configs per file if ( line . equals ( CONFIG_FILE_END_MARKER ) ) { break ; } // skip empty lines or comments if ( line . length ( ) == 0 || line . startsWith ( "#" ) || line . equals ( CONFIG_FILE_START_MARKER ) ) { continue ; } String [ ] parts = line . split ( "=" , - 2 ) ; if ( parts . length != 2 ) { throw new SQLException ( "DatabaseFieldConfig reading from stream cannot parse line: " + line ) ; } readField ( config , parts [ 0 ] , parts [ 1 ] ) ; anything = true ; } // if we got any config lines then we return the config if ( anything ) { return config ; } else { // otherwise we return null for none return null ; } }
Load a configuration in from a text file .