public class CharMap
extends Object
Modifier and Type | Field and Description |
---|---|
private FastCache |
cache
Keep a cache of lookups performed to-date
|
private static int |
CACHE_SIZE
How many recent mappings to maintain
|
private char[] |
map
The mapping of chars.
|
private static char |
NULL_CHAR
Special character to denote null list
|
private static int |
SUPP_HASH_SIZE
Size of supplimental mapping of chars... typically there are few
|
private IntHash |
supplementalCharsMap
Supplemental mapping of characters after the first
|
Constructor and Description |
---|
CharMap(File f)
Construct a char map by reading in a file.
|
CharMap(InputStream s)
Construct a char map by reading from an InputStream.
|
Modifier and Type | Method and Description |
---|---|
String |
mapWord(String word)
Map the characters in a word and return the mapped resulting word,
or null if no mappings found.
|
private void |
readFile(BufferedReader reader)
Read in the contents of a char file.
|
private char[] map
private static final char NULL_CHAR
private static final int SUPP_HASH_SIZE
private IntHash supplementalCharsMap
private static final int CACHE_SIZE
private FastCache cache
public CharMap(File f) throws IOException
IOException
public CharMap(InputStream s) throws IOException
IOException
public String mapWord(String word)
private void readFile(BufferedReader reader) throws IOException
reader
- Reader to get the data fromIOException