*/
BufferedReader rdr = new BufferedReader(new FileReader(readerGrassEnv.getCATS()));
try {
/* Instantiate attribute table */
AttributeTable attTable = new AttributeTable();
/* Ignore first 4 lines. */
rdr.readLine();
rdr.readLine();
rdr.readLine();
rdr.readLine();
/* Read next n lines */
String line;
while( (line = rdr.readLine()) != null ) {
/* All lines other than '0:no data' are processed */
if (line.indexOf("0:no data") == -1) { //$NON-NLS-1$
JlsTokenizer tk = new JlsTokenizer(line, ":"); //$NON-NLS-1$
if (tk.countTokens() == 2) {
float f = Float.parseFloat(tk.nextToken());
String att = tk.nextToken().trim();
attTable.addAttribute(f, att);
} else if (tk.countTokens() == 3) {
float f0 = Float.parseFloat(tk.nextToken());
float f1 = Float.parseFloat(tk.nextToken());
String att = tk.nextToken().trim();
attTable.addAttribute(f0, f1, att);
}
}
}
List<String> attrs = new ArrayList<String>();
Enumeration<CellAttribute> categories = attTable.getCategories();
while( categories.hasMoreElements() ) {
AttributeTable.CellAttribute object = categories.nextElement();
attrs.add(object.toString());
}