public static <T>DatabaseTableConfig<T> fromReader(BufferedReader reader) throws SQLException {
  DatabaseTableConfig<T> config=new DatabaseTableConfig<T>();
  boolean anything=false;
  while (true) {
    String line;
    try {
      line=reader.readLine();
    }
 catch (    IOException e) {
      throw SqlExceptionUtil.create("Could not read DatabaseTableConfig from stream",e);
    }
    if (line == null) {
      break;
    }
    if (line.equals(CONFIG_FILE_END_MARKER)) {
      break;
    }
    if (line.equals(CONFIG_FILE_FIELDS_START)) {
      readFields(reader,config);
      continue;
    }
    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("DatabaseTableConfig reading from stream cannot parse line: " + line);
    }
    readTableField(config,parts[0],parts[1]);
    anything=true;
  }
  if (anything) {
    return config;
  }
 else {
    return null;
  }
}

public static < T > DatabaseTableConfig < T > fromReader ( BufferedReader reader ) throws SQLException { DatabaseTableConfig < T > config = new DatabaseTableConfig < T > ( ) ; boolean anything = false ; while ( true ) { String line ; try { line = reader . readLine ( ) ; } catch ( IOException e ) { throw SqlExceptionUtil . create ( "Could not read DatabaseTableConfig from stream" , e ) ; } if ( line == null ) { break ; } if ( line . equals ( CONFIG_FILE_END_MARKER ) ) { break ; } if ( line . equals ( CONFIG_FILE_FIELDS_START ) ) { readFields ( reader , config ) ; continue ; } 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 ( "DatabaseTableConfig reading from stream cannot parse line: " + line ) ; } readTableField ( config , parts [ 0 ] , parts [ 1 ] ) ; anything = true ; } if ( anything ) { return config ; } else { return null ; } }
load a table configuration in from a text - file reader .
