public class NetworkTable extends java.lang.Object implements ITable, IRemote
| Modifier and Type | Field and Description | 
|---|---|
| static int | DEFAULT_PORTThe default port that network tables operates on | 
| static char | PATH_SEPARATORThe path separator for sub-tables and keys | 
| static int | PERSISTENTThe persistent flag value. | 
NOTIFY_DELETE, NOTIFY_FLAGS, NOTIFY_IMMEDIATE, NOTIFY_LOCAL, NOTIFY_NEW, NOTIFY_UPDATE| Modifier and Type | Method and Description | 
|---|---|
| void | addConnectionListener(IRemoteConnectionListener listener,
                     boolean immediateNotify)Register an object to listen for connection and disconnection events | 
| static void | addGlobalConnectionListener(IRemoteConnectionListener listener,
                           boolean immediateNotify) | 
| void | addSubTableListener(ITableListener listener)This will immediately notify the listener of all current sub tables | 
| void | addSubTableListener(ITableListener listener,
                   boolean localNotify)This will immediately notify the listener of all current sub tables | 
| void | addTableListener(ITableListener listener)Add a listener for changes to the table | 
| void | addTableListener(ITableListener listener,
                boolean immediateNotify)Add a listener for changes to the table | 
| void | addTableListener(java.lang.String key,
                ITableListener listener,
                boolean immediateNotify)Add a listener for changes to a specific key the table | 
| void | addTableListenerEx(ITableListener listener,
                  int flags)Add a listener for changes to the table | 
| void | addTableListenerEx(java.lang.String key,
                  ITableListener listener,
                  int flags)Add a listener for changes to a specific key the table | 
| void | clearFlags(java.lang.String key,
          int flags)Clears flags on the specified key in this table. | 
| void | clearPersistent(java.lang.String key)Stop making a key's value persistent through program restarts. | 
| static ConnectionInfo[] | connections() | 
| 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. | 
| static void | flush()Flushes all updated values immediately to the network. | 
| static java.lang.Boolean[] | fromNative(boolean[] arr) | 
| static java.lang.Double[] | fromNative(double[] arr) | 
| boolean | getBoolean(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getBoolean(String, boolean). | 
| boolean | getBoolean(java.lang.String key,
          boolean defaultValue)Returns the boolean the key maps to. | 
| boolean[] | getBooleanArray(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getBooleanArray(String, boolean[]). | 
| boolean[] | getBooleanArray(java.lang.String key,
               boolean[] defaultValue)Returns the boolean array the key maps to. | 
| java.lang.Boolean[] | getBooleanArray(java.lang.String key,
               java.lang.Boolean[] defaultValue)Returns the boolean array the key maps to. | 
| double | getDouble(java.lang.String key)Deprecated. 
 Use  getNumber(String, double)instead. | 
| double | getDouble(java.lang.String key,
         double defaultValue)Deprecated. 
 Use  getNumber(String, double)instead. | 
| int | getFlags(java.lang.String key)Returns the flags for the specified key. | 
| int | getInt(java.lang.String key)Deprecated. 
 Use  getNumber(String, double)instead. | 
| int | getInt(java.lang.String key,
      int defaultValue)Deprecated. 
 Use  getNumber(String, double)instead. | 
| java.util.Set<java.lang.String> | getKeys() | 
| java.util.Set<java.lang.String> | getKeys(int types) | 
| double | getNumber(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getNumber(String, double). | 
| double | getNumber(java.lang.String key,
         double defaultValue)Returns the number the key maps to. | 
| double[] | getNumberArray(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getNumberArray(String, double[]). | 
| double[] | getNumberArray(java.lang.String key,
              double[] defaultValue)Returns the number array the key maps to. | 
| java.lang.Double[] | getNumberArray(java.lang.String key,
              java.lang.Double[] defaultValue)Returns the number array the key maps to. | 
| byte[] | getRaw(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getRaw(String, byte[]). | 
| byte[] | getRaw(java.lang.String key,
      byte[] defaultValue)Returns the raw value (byte array) the key maps to. | 
| java.lang.String | getString(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getString(String, String). | 
| java.lang.String | getString(java.lang.String key,
         java.lang.String defaultValue)Returns the string the key maps to. | 
| java.lang.String[] | getStringArray(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getStringArray(String, String[]). | 
| java.lang.String[] | getStringArray(java.lang.String key,
              java.lang.String[] defaultValue)Returns the string array the key maps to. | 
| ITable | getSubTable(java.lang.String key)Returns the table at the specified key. | 
| java.util.Set<java.lang.String> | getSubTables() | 
| static NetworkTable | getTable(java.lang.String key)Gets the table with the specified key. | 
| java.lang.Object | getValue(java.lang.String key)Deprecated. 
 This exception-raising method has been replaced by the
 default-taking method  getValue(String, Object). | 
| java.lang.Object | getValue(java.lang.String key,
        java.lang.Object defaultValue)Gets the value associated with a key as an object. | 
| static void | globalDeleteAll()Deletes ALL keys in ALL subtables. | 
| static void | initialize()initializes network tables | 
| boolean | isConnected()Get the current state of the objects connection | 
| boolean | isPersistent(java.lang.String key)Returns whether the value is persistent through program restarts. | 
| boolean | isServer()If the object is acting as a server | 
| static java.lang.String[] | loadPersistent(java.lang.String filename)Loads persistent keys from a file. | 
| boolean | putBoolean(java.lang.String key,
          boolean value)Put a boolean in the table | 
| boolean | putBooleanArray(java.lang.String key,
               boolean[] value)Put a boolean array in the table | 
| boolean | putBooleanArray(java.lang.String key,
               java.lang.Boolean[] value)Put a boolean array in the table | 
| boolean | putDouble(java.lang.String key,
         double value)Deprecated. 
 Use  putNumber(String, double)instead. | 
| boolean | putInt(java.lang.String key,
      int value)Deprecated. 
 Use  putNumber(String, double)instead. | 
| boolean | putNumber(java.lang.String key,
         double value)Put a number in the table | 
| boolean | putNumberArray(java.lang.String key,
              double[] value)Put a number array in the table | 
| boolean | putNumberArray(java.lang.String key,
              java.lang.Double[] value)Put a number array in the table | 
| boolean | putRaw(java.lang.String key,
      byte[] value)Put a raw value (byte array) in the table | 
| boolean | putRaw(java.lang.String key,
      java.nio.ByteBuffer value,
      int len)Put a raw value (bytes from a byte buffer) in the table | 
| boolean | putString(java.lang.String key,
         java.lang.String value)Put a string in the table | 
| boolean | putStringArray(java.lang.String key,
              java.lang.String[] value)Put a string array in the table | 
| boolean | putValue(java.lang.String key,
        java.lang.Object value)Put a value in the table | 
| void | removeConnectionListener(IRemoteConnectionListener listener)Unregister a listener from connection events | 
| static void | removeGlobalConnectionListener(IRemoteConnectionListener listener) | 
| void | removeTableListener(ITableListener listener)Remove a listener from receiving table events | 
| void | retrieveValue(java.lang.String key,
             java.lang.Object externalData)Deprecated. 
 Use get*Array functions instead. | 
| static void | savePersistent(java.lang.String filename)Saves persistent keys to a file. | 
| static void | setClientMode()set that network tables should be a client
 This must be called before initialize or getTable | 
| boolean | setDefaultBoolean(java.lang.String key,
                 boolean defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultBooleanArray(java.lang.String key,
                      boolean[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultBooleanArray(java.lang.String key,
                      java.lang.Boolean[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultNumber(java.lang.String key,
                double defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultNumberArray(java.lang.String key,
                     double[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultNumberArray(java.lang.String key,
                     java.lang.Double[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultRaw(java.lang.String key,
             byte[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultString(java.lang.String key,
                java.lang.String defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| boolean | setDefaultStringArray(java.lang.String key,
                     java.lang.String[] defaultValue)Gets the current value in the table, setting it if it does not exist. | 
| static void | setDSClientEnabled(boolean enabled) | 
| void | setFlags(java.lang.String key,
        int flags)Sets flags on the specified key in this table. | 
| static void | setIPAddress(java.lang.String address) | 
| static void | setIPAddress(java.lang.String[] addresses) | 
| static void | setNetworkIdentity(java.lang.String name)Sets the network identity. | 
| void | setPersistent(java.lang.String key)Makes a key's value persistent through program restarts. | 
| static void | setPersistentFilename(java.lang.String filename)Sets the persistent filename. | 
| static void | setPort(int aport) | 
| static void | setServerMode()set that network tables should be a server
 This must be called before initialize or getTable | 
| static void | setTeam(int team)set the team the robot is configured for (this will set the mdns address that
 network tables will connect to in client mode)
 This must be called before initialize or getTable | 
| static void | setUpdateRate(double interval)Set the periodic update rate. | 
| static void | shutdown()shuts down network tables | 
| static boolean[] | toNative(java.lang.Boolean[] arr) | 
| static double[] | toNative(java.lang.Number[] arr) | 
| java.lang.String | toString() | 
public static final char PATH_SEPARATOR
public static final int DEFAULT_PORT
public static final int PERSISTENT
public static void initialize()
public static void shutdown()
public static void setServerMode()
public static void setClientMode()
public static void setTeam(int team)
team - the team numberpublic static void setIPAddress(java.lang.String address)
address - the adress that network tables will connect to in client
 modepublic static void setIPAddress(java.lang.String[] addresses)
addresses - the adresses that network tables will connect to in
 client mode (in round robin order)public static void setPort(int aport)
aport - the port number that network tables will connect to in client
 mode or listen to in server modepublic static void setDSClientEnabled(boolean enabled)
enabled - whether to enable the connection to the local DS to get
 the robot IP address (defaults to enabled)public static void setPersistentFilename(java.lang.String filename)
filename - the filename that the network tables server uses for
 automatic loading and saving of persistent valuespublic static void setNetworkIdentity(java.lang.String name)
name - identitypublic static boolean[] toNative(java.lang.Boolean[] arr)
public static double[] toNative(java.lang.Number[] arr)
public static java.lang.Boolean[] fromNative(boolean[] arr)
public static java.lang.Double[] fromNative(double[] arr)
public static NetworkTable getTable(java.lang.String key)
key - the key namepublic java.lang.String toString()
toString in class java.lang.Objectpublic static ConnectionInfo[] connections()
public boolean isConnected()
IRemoteisConnected in interface IRemotepublic boolean isServer()
IRemotepublic static void addGlobalConnectionListener(IRemoteConnectionListener listener, boolean immediateNotify)
public static void removeGlobalConnectionListener(IRemoteConnectionListener listener)
public void addConnectionListener(IRemoteConnectionListener listener, boolean immediateNotify)
IRemoteaddConnectionListener in interface IRemotelistener - the listener to be registerimmediateNotify - if the listener object should be notified of the current connection statepublic void removeConnectionListener(IRemoteConnectionListener listener)
IRemoteremoveConnectionListener in interface IRemotelistener - the listener to be unregisteredpublic void addTableListener(ITableListener listener)
addTableListener in interface ITablelistener - the listener to addpublic void addTableListener(ITableListener listener, boolean immediateNotify)
addTableListener in interface ITablelistener - the listener to addimmediateNotify - if true then this listener will be notified of all
 current entries (marked as new)public void addTableListenerEx(ITableListener listener, int flags)
ITableaddTableListenerEx in interface ITablelistener - the listener to addflags - bitmask specifying desired notificationspublic void addTableListener(java.lang.String key, ITableListener listener, boolean immediateNotify)
addTableListener in interface ITablekey - the key to listen forlistener - the listener to addimmediateNotify - if true then this listener will be notified of all
 current entries (marked as new)public void addTableListenerEx(java.lang.String key, ITableListener listener, int flags)
addTableListenerEx in interface ITablekey - the key to listen forlistener - the listener to addflags - bitmask specifying desired notificationspublic void addSubTableListener(ITableListener listener)
addSubTableListener in interface ITablelistener - the listener to notifypublic void addSubTableListener(ITableListener listener, boolean localNotify)
addSubTableListener in interface ITablelistener - the listener to notifylocalNotify - if true then this listener will be notified of all
 local changes in addition to all remote changespublic void removeTableListener(ITableListener listener)
removeTableListener in interface ITablelistener - the listener to be removedpublic ITable getSubTable(java.lang.String key)
getSubTable in interface ITablekey - the name of the table relative to this onepublic boolean containsKey(java.lang.String key)
containsKey in interface ITablekey - the key to search forpublic boolean containsSubTable(java.lang.String key)
containsSubTable in interface ITablekey - the key to search forpublic java.util.Set<java.lang.String> getKeys(int types)
public java.util.Set<java.lang.String> getKeys()
public java.util.Set<java.lang.String> getSubTables()
getSubTables in interface ITablepublic boolean putNumber(java.lang.String key, double value)
public boolean setDefaultNumber(java.lang.String key, double defaultValue)
setDefaultNumber in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public double getNumber(java.lang.String key) throws TableKeyNotDefinedException
getNumber(String, double).getNumber in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic double getNumber(java.lang.String key, double defaultValue)
public boolean putString(java.lang.String key, java.lang.String value)
public boolean setDefaultString(java.lang.String key, java.lang.String defaultValue)
setDefaultString in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public java.lang.String getString(java.lang.String key) throws TableKeyNotDefinedException
getString(String, String).getString in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
public boolean putBoolean(java.lang.String key, boolean value)
putBoolean in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean setDefaultBoolean(java.lang.String key, boolean defaultValue)
setDefaultBoolean in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public boolean getBoolean(java.lang.String key) throws TableKeyNotDefinedException
getBoolean(String, boolean).getBoolean in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic boolean getBoolean(java.lang.String key, boolean defaultValue)
getBoolean in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic boolean putBooleanArray(java.lang.String key, boolean[] value)
putBooleanArray in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean putBooleanArray(java.lang.String key, java.lang.Boolean[] value)
putBooleanArray in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean setDefaultBooleanArray(java.lang.String key, boolean[] defaultValue)
setDefaultBooleanArray in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.public boolean setDefaultBooleanArray(java.lang.String key, java.lang.Boolean[] defaultValue)
setDefaultBooleanArray in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public boolean[] getBooleanArray(java.lang.String key) throws TableKeyNotDefinedException
getBooleanArray(String, boolean[]).getBooleanArray in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic boolean[] getBooleanArray(java.lang.String key, boolean[] defaultValue)
getBooleanArray in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic java.lang.Boolean[] getBooleanArray(java.lang.String key, java.lang.Boolean[] defaultValue)
getBooleanArray in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic boolean putNumberArray(java.lang.String key, double[] value)
putNumberArray in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean putNumberArray(java.lang.String key, java.lang.Double[] value)
putNumberArray in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean setDefaultNumberArray(java.lang.String key, double[] defaultValue)
setDefaultNumberArray in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.public boolean setDefaultNumberArray(java.lang.String key, java.lang.Double[] defaultValue)
setDefaultNumberArray in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public double[] getNumberArray(java.lang.String key) throws TableKeyNotDefinedException
getNumberArray(String, double[]).getNumberArray in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic double[] getNumberArray(java.lang.String key, double[] defaultValue)
getNumberArray in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic java.lang.Double[] getNumberArray(java.lang.String key, java.lang.Double[] defaultValue)
getNumberArray in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic boolean putStringArray(java.lang.String key, java.lang.String[] value)
putStringArray in interface ITablekey - the key to be assigned tovalue - the value that will be assignedpublic boolean setDefaultStringArray(java.lang.String key, java.lang.String[] defaultValue)
setDefaultStringArray in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.@Deprecated public java.lang.String[] getStringArray(java.lang.String key) throws TableKeyNotDefinedException
getStringArray(String, String[]).getStringArray in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] defaultValue)
getStringArray in interface ITablekey - the key to look updefaultValue - the value to be returned if no value is foundpublic boolean putRaw(java.lang.String key, byte[] value)
public boolean setDefaultRaw(java.lang.String key, byte[] defaultValue)
setDefaultRaw in interface ITablekey - the keydefaultValue - the default value to set if key doens't exist.public boolean putRaw(java.lang.String key, java.nio.ByteBuffer value, int len)
@Deprecated public byte[] getRaw(java.lang.String key) throws TableKeyNotDefinedException
getRaw(String, byte[]).getRaw in interface ITablekey - the key to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic byte[] getRaw(java.lang.String key, byte[] defaultValue)
public boolean putValue(java.lang.String key, java.lang.Object value) throws java.lang.IllegalArgumentException
@Deprecated public void retrieveValue(java.lang.String key, java.lang.Object externalData) throws TableKeyNotDefinedException
retrieveValue in interface ITablekey - the key to be assigned toexternalData - the array data type to retreive intoTableKeyNotDefinedException - if there is no value associated with
 the given key@Deprecated public java.lang.Object getValue(java.lang.String key) throws TableKeyNotDefinedException
getValue(String, Object).ITable.getDouble(String, double).getValue in interface ITablekey - the key of the value to look upTableKeyNotDefinedException - if there is no value associated with
 the given keypublic java.lang.Object getValue(java.lang.String key, java.lang.Object defaultValue)
ITable.getDouble(String, double).public void setPersistent(java.lang.String key)
setPersistent in interface ITablekey - the key namepublic void clearPersistent(java.lang.String key)
clearPersistent in interface ITablekey - the key namepublic boolean isPersistent(java.lang.String key)
isPersistent in interface ITablekey - the key namepublic void setFlags(java.lang.String key, int flags)
public void clearFlags(java.lang.String key, int flags)
clearFlags in interface ITablekey - the key nameflags - the flags to clear (bitmask)public int getFlags(java.lang.String key)
public void delete(java.lang.String key)
public static void globalDeleteAll()
public static void flush()
public static void setUpdateRate(double interval)
interval - update interval in seconds (range 0.01 to 1.0)public static void savePersistent(java.lang.String filename) throws PersistentException
filename - file namePersistentException - if error saving filepublic static java.lang.String[] loadPersistent(java.lang.String filename) throws PersistentException
filename - file namePersistentException - if error reading file@Deprecated public boolean putInt(java.lang.String key, int value)
putNumber(String, double) instead.@Deprecated public int getInt(java.lang.String key) throws TableKeyNotDefinedException
getNumber(String, double) instead.getInt in interface ITablekey - the keyTableKeyNotDefinedException - if there is no value mapped to by the
 key@Deprecated public int getInt(java.lang.String key, int defaultValue) throws TableKeyNotDefinedException
getNumber(String, double) instead.getInt in interface ITablekey - the keydefaultValue - the value returned if the key is undefinedTableKeyNotDefinedException@Deprecated public boolean putDouble(java.lang.String key, double value)
putNumber(String, double) instead.@Deprecated public double getDouble(java.lang.String key) throws TableKeyNotDefinedException
getNumber(String, double) instead.getDouble in interface ITablekey - the keyTableKeyNotDefinedException - if there is no
 value mapped to by the key@Deprecated public double getDouble(java.lang.String key, double defaultValue)
getNumber(String, double) instead.