public class AliasTable
extends java.lang.Object
Constructor and Description |
---|
AliasTable()
Creates a new AliasTable with no entries.
|
AliasTable(java.io.File file)
Creates a new AliasTable and reads it's initial entries from a file.
|
AliasTable(java.net.URL url)
Creates a new AliasTable and reads it's initial entries from a resource.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntry(java.lang.String alias,
java.lang.String name)
Adds an alias and it's corresponding name to this AliasTable.
|
void |
clear()
Clears all entries from the AliasTable
|
boolean |
containsAlias(java.lang.String alias)
Returns true if this table contains the specified alias.
|
boolean |
containsName(java.lang.String name)
Returns true if this table contains the specified name.
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entrySet()
Returns a Set view of the entries for this table.
|
java.lang.String |
getAlias(java.lang.String name)
Gets the first alias found that references a given name, or null if no
such alias is found.
|
java.lang.String[] |
getAliases()
Returns a list of all the aliases in this table.
|
java.lang.String |
getName(java.lang.String alias)
Gets the name referenced by a given alias, or null if the alias has no
entry.
|
java.lang.String[] |
getNames()
Returns a list of all the names in this table.
|
void |
read(java.io.InputStream s)
Reads the contents of an input stream and adds every successive pair of
strings into this table as an alias/name pair.
|
void |
removeEntry(java.lang.String alias)
Removes an alias from this AliasTable.
|
public AliasTable()
public AliasTable(java.io.File file) throws java.io.IOException
file
- File from which to read table entriesjava.io.IOException
- if there was an error reading the filepublic AliasTable(java.net.URL url) throws java.io.IOException
url
- Resource from which to read table entriesjava.io.IOException
- if there was an error reading the resourcepublic void read(java.io.InputStream s) throws java.io.IOException
"
or by whitespace.
Whitespace-delineated strings may contain alphanumeric characters, plus
the characters $./_-
, but must not start with a digit.
Quoted strings may contain any character and support the usual escape
sequences. This function returns a list of all the aliases read.s
- Stream from which to read table entriesjava.io.IOException
- if there was an error reading the streampublic void addEntry(java.lang.String alias, java.lang.String name)
alias
- alias which references the namename
- name which is referenced by the aliaspublic void removeEntry(java.lang.String alias)
alias
- alias which references the namepublic void clear()
public java.lang.String getName(java.lang.String alias)
alias
- alias which references the namepublic java.lang.String getAlias(java.lang.String name)
name
- name which is referencedpublic java.lang.String[] getAliases()
public java.lang.String[] getNames()
public boolean containsName(java.lang.String name)
name
- to check forpublic boolean containsAlias(java.lang.String alias)
alias
- to check forpublic java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()