public final class NetworkTable extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char |
PATH_SEPARATOR
The path separator for sub-tables and keys
|
Modifier and Type | Method and Description |
---|---|
int |
addEntryListener(java.lang.String key,
TableEntryListener listener,
int flags)
Listen to a single key.
|
int |
addEntryListener(TableEntryListener listener,
int flags)
Listen to keys only within this table.
|
int |
addSubTableListener(TableListener listener,
boolean localNotify)
Listen for sub-table creation.
|
static java.lang.String |
basenameKey(java.lang.String key)
Gets the "base name" of a key.
|
boolean |
containsKey(java.lang.String key)
Checks the table and tells if it contains the specified key
|
boolean |
containsSubTable(java.lang.String key) |
void |
delete(java.lang.String key)
Deletes the specified key in this table.
|
boolean |
equals(java.lang.Object o) |
NetworkTableEntry |
getEntry(java.lang.String key)
Gets the entry for a subkey.
|
static java.util.List<java.lang.String> |
getHierarchy(java.lang.String key)
Gets a list of the names of all the super tables of a given key.
|
NetworkTableInstance |
getInstance()
Gets the instance for the table.
|
java.util.Set<java.lang.String> |
getKeys()
Gets all keys in the table (not including sub-tables).
|
java.util.Set<java.lang.String> |
getKeys(int types)
Gets all keys in the table (not including sub-tables).
|
java.lang.String |
getPath() |
NetworkTable |
getSubTable(java.lang.String key)
Returns the table at the specified key.
|
java.util.Set<java.lang.String> |
getSubTables()
Gets the names of all subtables in the table.
|
int |
hashCode() |
java.lang.String[] |
loadEntries(java.lang.String filename)
Load table values from a file.
|
static java.lang.String |
normalizeKey(java.lang.String key)
Normalizes a network table key to start with exactly one leading slash
("/") and contain no consecutive slashes.
|
static java.lang.String |
normalizeKey(java.lang.String key,
boolean withLeadingSlash)
Normalizes an network table key to contain no consecutive slashes and
optionally start with a leading slash.
|
void |
removeEntryListener(int listener)
Remove an entry listener.
|
void |
removeTableListener(int listener)
Remove a sub-table listener.
|
void |
saveEntries(java.lang.String filename)
Save table values to a file.
|
java.lang.String |
toString() |
public static final char PATH_SEPARATOR
public static java.lang.String basenameKey(java.lang.String key)
key
- keypublic static java.lang.String normalizeKey(java.lang.String key, boolean withLeadingSlash)
normalizeKey("/foo/bar", true) == "/foo/bar"
normalizeKey("foo/bar", true) == "/foo/bar"
normalizeKey("/foo/bar", false) == "foo/bar"
normalizeKey("foo//bar", false) == "foo/bar"
key
- the key to normalizewithLeadingSlash
- whether or not the normalized key should begin
with a leading slashpublic static java.lang.String normalizeKey(java.lang.String key)
"//foo/bar/"
becomes "/foo/bar/"
and
"///a/b/c"
becomes "/a/b/c"
.
This is equivalent to normalizeKey(key, true)
key
- the key to normalizepublic static java.util.List<java.lang.String> getHierarchy(java.lang.String key)
key
- the keypublic NetworkTableInstance getInstance()
public java.lang.String toString()
toString
in class java.lang.Object
public NetworkTableEntry getEntry(java.lang.String key)
key
- the key namepublic int addEntryListener(TableEntryListener listener, int flags)
listener
- listener to addflags
- EntryListenerFlags
bitmaskpublic int addEntryListener(java.lang.String key, TableEntryListener listener, int flags)
key
- the key namelistener
- listener to addflags
- EntryListenerFlags
bitmaskpublic void removeEntryListener(int listener)
listener
- listener handlepublic int addSubTableListener(TableListener listener, boolean localNotify)
listener
- listener to addlocalNotify
- notify local changes as well as remotepublic void removeTableListener(int listener)
listener
- listener handlepublic NetworkTable getSubTable(java.lang.String key)
key
- the name of the table relative to this onepublic boolean containsKey(java.lang.String key)
key
- the key to search forpublic boolean containsSubTable(java.lang.String key)
key
- the key to search forpublic java.util.Set<java.lang.String> getKeys(int types)
types
- bitmask of types; 0 is treated as a "don't care".public java.util.Set<java.lang.String> getKeys()
public java.util.Set<java.lang.String> getSubTables()
public void delete(java.lang.String key)
key
- the key namepublic java.lang.String getPath()
public void saveEntries(java.lang.String filename) throws PersistentException
filename
- filenamePersistentException
- if error saving filepublic java.lang.String[] loadEntries(java.lang.String filename) throws PersistentException
filename
- filenamePersistentException
- if error saving filepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object