public void parse ( InputStream inputStream ) throws IOException { currentMatrix = null ; currentRows = "" ; currentCols = "" ; max = Short . MIN_VALUE ; min = Short . MAX_VALUE ; inMatrix = false ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line = null ; line = buf . readLine ( ) ; while ( line != null ) { if ( line . startsWith ( "//" ) ) { finalizeMatrix ( ) ; inMatrix = false ; } else if ( line . startsWith ( "H " ) ) { // a new matric! newMatrix ( line ) ; } else if ( line . startsWith ( "D " ) ) { currentMatrix . setDescription ( line . substring ( 2 ) ) ; } else if ( line . startsWith ( "M " ) ) { initMatrix ( line ) ; inMatrix = true ; } else if ( line . startsWith ( " " ) ) { if ( inMatrix ) processScores ( line ) ; } line = buf . readLine ( ) ; } }
parse an inputStream that points to an AAINDEX database file