private void readHeader ( BufferedReader br ) throws IOException { String line ; // Locate header line while ( true ) { line = br . readLine ( ) ; if ( line == null ) { throw new AbortException ( ARFF_HEADER_RELATION + " not found in file." ) ; } // Skip comments and empty lines if ( ARFF_COMMENT . reset ( line ) . matches ( ) || EMPTY . reset ( line ) . matches ( ) ) { continue ; } // Break on relation statement if ( ARFF_HEADER_RELATION . reset ( line ) . matches ( ) ) { break ; } throw new AbortException ( "Expected relation declaration: " + line ) ; } }
Read the dataset header part of the ARFF file to ensure consistency .