code: public static Attribute[] getAttributes(InputStream stream) throws IOException, ParseException {
          Reader r = new BufferedReader(new InputStreamReader(stream));
          StreamTokenizer tokenizer = new StreamTokenizer(r);
          
          ArffParser parser = new ArffParser();
          parser.initTokenizer(tokenizer);
  
          List<Attribute> attributes = new ArrayList<>();
          parser.readHeader(tokenizer, attributes);
  
          return attributes.toArray(new Attribute[attributes.size()]);
      }
docs: Returns the attribute set of given stream.