]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/inlines/Entities.java
(refs #7541) Added support for module deprecation
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / markdown / inlines / Entities.java
1 package org.simantics.scl.compiler.markdown.inlines;
2
3 import java.io.BufferedReader;
4 import java.io.InputStreamReader;
5 import java.nio.charset.Charset;
6
7 import gnu.trove.map.hash.THashMap;
8
9 public class Entities {
10     public static final THashMap<String, String> ENTITY_MAP = new THashMap<String, String>();
11     public static int MAX_ENTITY_LENGTH;
12     
13     static {
14         try {
15             BufferedReader reader = new BufferedReader(new InputStreamReader(Entities.class.getResourceAsStream("entities.dat"), Charset.forName("UTF-8")));
16             String line;
17             MAX_ENTITY_LENGTH = 0;
18             while((line = reader.readLine()) != null) {
19                 if(line.isEmpty())
20                     continue;
21                 int p = line.indexOf(' ');
22                 String entity = line.substring(0, p);
23                 String character = line.substring(p+1);
24                 ENTITY_MAP.put(entity, character);
25                 MAX_ENTITY_LENGTH = Math.max(MAX_ENTITY_LENGTH, entity.length());
26             }
27         } catch(Exception e) {
28             e.printStackTrace();
29         }
30     }
31 }