jTracer  1.03
Stack trace visualization tool
void org.libcsdbg.jtracer.Highlighter.loadDictionary ( String  nm) throws IOException

Load a dictionary.

Parameters
[in]nmthe dictionary name (resource config/nm.dict)

Definition at line 53 of file Highlighter.java.

54  {
55  File src = Registry.getCurrent().getResource("config/" + nm + ".dict");
56  String path = src.getCanonicalPath();
57 
58  if (!src.isFile())
59  throw new IOException("Dictionary '" + path + "' doesn't exist");
60 
61  else if (!src.canRead())
62  throw new IOException("Can't read dictionary '" + path + "'");
63 
64  BufferedReader reader = new BufferedReader(new FileReader(src));
65  Vector<String> words = new Vector<String>();
66 
67  while (true) {
68  String line = reader.readLine();
69  if (line == null)
70  break;
71 
72  line = line.trim();
73  if (line.length() > 0)
74  words.add(line);
75  }
76 
77  reader.close();
78  put(nm, words);
79  }