code: private String readHeader(StreamTokenizer tokenizer, List<Attribute> attributes) throws IOException, ParseException {
          /// The name of dataset.
          String relationName = null;
          // clear attribute set, which may be from previous parsing of other datasets.
          attributes.clear();
  
          // Get name of relation.
          getFirstToken(tokenizer);
          if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
              throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
          }
          if (ARFF_RELATION.equalsIgnoreCase(tokenizer.sval)) {
              getNextToken(tokenizer);
              relationName = tokenizer.sval;
              getLastToken(tokenizer, false);
          } else {
              throw new ParseException("keyword " + ARFF_RELATION + " expected", tokenizer.lineno());
          }
  
          // Get attribute declarations.
          getFirstToken(tokenizer);
          if (tokenizer.ttype == StreamTokenizer.TT_EOF) {
              throw new ParseException(PREMATURE_END_OF_FILE, tokenizer.lineno());
          }
  
          while (ARFF_ATTRIBUTE.equalsIgnoreCase(tokenizer.sval)) {
              attributes.add(parseAttribute(tokenizer));
          }
  
          // Check if data part follows. We can't easily check for EOL.
          if (!ARFF_DATA.equalsIgnoreCase(tokenizer.sval)) {
              throw new ParseException("keyword " + ARFF_DATA + " expected", tokenizer.lineno());
          }
  
          // Check if any attributes have been declared.
          if (attributes.isEmpty()) {
              throw new ParseException("no attributes declared", tokenizer.lineno());
          }
          
          if (responseIndex >= attributes.size()) {
              throw new ParseException("Invalid response variable index", responseIndex);            
          }
          
          return relationName;
      }
docs: Reads and stores header of an ARFF file.
  
  @param attributes the set of attributes in this relation.
  @return the name of relation.
  @throws IllegalStateException if the information is not read successfully