Package edu.wpi.first.networktables
Class NetworkTableEntry
java.lang.Object
edu.wpi.first.networktables.NetworkTableEntry
- All Implemented Interfaces:
Publisher,PubSub,Subscriber,AutoCloseable
NetworkTables Entry.
For backwards compatibility, the NetworkTableEntry close() does not release the entry.
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkTableEntry(NetworkTableInstance inst, int handle) Construct from native handle.NetworkTableEntry(Topic topic, int handle) Construct from native handle. -
Method Summary
Modifier and TypeMethodDescriptionvoidStop making value persistent through program restarts.voidclose()booleanbooleanexists()Determines if the entry currently exists.booleangetBoolean(boolean defaultValue) Gets the entry's value as a boolean.boolean[]getBooleanArray(boolean[] defaultValue) Gets the entry's value as a boolean[].Boolean[]getBooleanArray(Boolean[] defaultValue) Gets the entry's value as a boolean array.doublegetDouble(double defaultValue) Gets the entry's value as a double.double[]getDoubleArray(double[] defaultValue) Gets the entry's value as a double[].Double[]getDoubleArray(Double[] defaultValue) Gets the entry's value as a boolean array.floatgetFloat(float defaultValue) Gets the entry's value as a float.float[]getFloatArray(float[] defaultValue) Gets the entry's value as a float[].Float[]getFloatArray(Float[] defaultValue) Gets the entry's value as a boolean array.intGets the native handle for the entry.Gets the instance for the entry.longgetInteger(long defaultValue) Gets the entry's value as a long.long[]getIntegerArray(long[] defaultValue) Gets the entry's value as a long[].Long[]getIntegerArray(Long[] defaultValue) Gets the entry's value as a boolean array.longGets the last time the entry's value was changed.getName()Gets the name of the entry (the key).Gets the entry's value as a double.Number[]getNumberArray(Number[] defaultValue) Gets the entry's value as a double array.byte[]getRaw(byte[] defaultValue) Gets the entry's value as a byte[].Gets the entry's value as a String.String[]getStringArray(String[] defaultValue) Gets the entry's value as a String[].getTopic()Gets the subscribed-to / published-to topic.getType()Gets the type of the entry.getValue()Gets the entry's value.inthashCode()booleanReturns whether the value is persistent through program restarts.booleanisValid()Determines if the native handle is valid.static booleanisValidDataType(Object data) Checks if a data value is of a type that can be placed in a NetworkTable entry.Get an array of all value changes since the last call to readQueue.booleansetBoolean(boolean value) Sets the entry's value.booleansetBooleanArray(boolean[] value) Sets the entry's value.booleansetBooleanArray(Boolean[] value) Sets the entry's value.booleansetDefaultBoolean(boolean defaultValue) Sets the entry's value if it does not exist.booleansetDefaultBooleanArray(boolean[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultBooleanArray(Boolean[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultDouble(double defaultValue) Sets the entry's value if it does not exist.booleansetDefaultDoubleArray(double[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultDoubleArray(Double[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultFloat(float defaultValue) Sets the entry's value if it does not exist.booleansetDefaultFloatArray(float[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultFloatArray(Float[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultInteger(long defaultValue) Sets the entry's value if it does not exist.booleansetDefaultIntegerArray(long[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultIntegerArray(Long[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultNumber(Number defaultValue) Sets the entry's value if it does not exist.booleansetDefaultNumberArray(Number[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultRaw(byte[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultRaw(byte[] defaultValue, int start, int len) Sets the entry's value if it does not exist.booleansetDefaultRaw(ByteBuffer defaultValue) Sets the entry's value if it does not exist.booleansetDefaultRaw(ByteBuffer defaultValue, int start, int len) Sets the entry's value if it does not exist.booleansetDefaultString(String defaultValue) Sets the entry's value if it does not exist.booleansetDefaultStringArray(String[] defaultValue) Sets the entry's value if it does not exist.booleansetDefaultValue(Object defaultValue) Sets the entry's value if it does not exist.booleansetDouble(double value) Sets the entry's value.booleansetDoubleArray(double[] value) Sets the entry's value.booleansetDoubleArray(Double[] value) Sets the entry's value.booleansetFloat(float value) Sets the entry's value.booleansetFloatArray(float[] value) Sets the entry's value.booleansetFloatArray(Float[] value) Sets the entry's value.booleansetInteger(long value) Sets the entry's value.booleansetIntegerArray(long[] value) Sets the entry's value.booleansetIntegerArray(Long[] value) Sets the entry's value.booleanSets the entry's value.booleansetNumberArray(Number[] value) Sets the entry's value.voidMake value persistent through program restarts.booleansetRaw(byte[] value) Sets the entry's value.booleansetRaw(byte[] value, int start, int len) Sets the entry's value.booleansetRaw(ByteBuffer value) Sets the entry's value.booleansetRaw(ByteBuffer value, int start, int len) Sets the entry's value.booleanSets the entry's value.booleansetStringArray(String[] value) Sets the entry's value.booleanSets the entry's value.voidStops publishing the entry if it's been published.
-
Constructor Details
-
NetworkTableEntry
Construct from native handle.- Parameters:
inst- Instancehandle- Native handle
-
NetworkTableEntry
Construct from native handle.- Parameters:
topic- Topichandle- Native handle
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePubSub
-
isValid
Determines if the native handle is valid. -
getHandle
Gets the native handle for the entry. -
getTopic
Gets the subscribed-to / published-to topic. -
getInstance
Gets the instance for the entry.- Returns:
- Instance
-
exists
Determines if the entry currently exists.- Specified by:
existsin interfaceSubscriber- Returns:
- True if the entry exists, false otherwise.
-
getName
Gets the name of the entry (the key).- Returns:
- the entry's name
-
getType
Gets the type of the entry.- Returns:
- the entry's type
-
getLastChange
Gets the last time the entry's value was changed.- Specified by:
getLastChangein interfaceSubscriber- Returns:
- Entry last change time
-
getValue
Gets the entry's value. Returns a value with type NetworkTableType.kUnassigned if the value does not exist.- Returns:
- the entry's value
-
getBoolean
Gets the entry's value as a boolean. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getInteger
Gets the entry's value as a long. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloat
Gets the entry's value as a float. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDouble
Gets the entry's value as a double. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getString
Gets the entry's value as a String. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getRaw
Gets the entry's value as a byte[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getBooleanArray
Gets the entry's value as a boolean[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getBooleanArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getIntegerArray
Gets the entry's value as a long[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getIntegerArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloatArray
Gets the entry's value as a float[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getFloatArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDoubleArray
Gets the entry's value as a double[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getDoubleArray
Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getStringArray
Gets the entry's value as a String[]. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getNumber
Gets the entry's value as a double. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
getNumberArray
Gets the entry's value as a double array. If the entry does not exist or is of different type, it will return the default value.- Parameters:
defaultValue- the value to be returned if no value is found- Returns:
- the entry's value or the given default value
-
readQueue
Get an array of all value changes since the last call to readQueue.The "poll storage" subscribe option can be used to set the queue depth.
- Returns:
- Array of values; empty array if no new changes have been published since the previous call.
-
isValidDataType
Checks if a data value is of a type that can be placed in a NetworkTable entry.- Parameters:
data- the data to check- Returns:
- true if the data can be placed in an entry, false if it cannot
-
setDefaultValue
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
- Throws:
IllegalArgumentException- if the value is not a known type
-
setDefaultBoolean
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultInteger
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultFloat
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultDouble
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultString
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultRaw
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultRaw
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set; will send from defaultValue.position() to defaultValue.capacity()- Returns:
- False if the entry exists with a different type
-
setDefaultRaw
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to setstart- Start position of data (in buffer)len- Length of data (must be less than or equal to value.length - start)- Returns:
- False if the entry exists with a different type
-
setDefaultRaw
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to setstart- Start position of data (in buffer)len- Length of data (must be less than or equal to value.capacity() - start)- Returns:
- False if the entry exists with a different type
-
setDefaultBooleanArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultBooleanArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultIntegerArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultIntegerArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultFloatArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultFloatArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultDoubleArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultDoubleArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultStringArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultNumber
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setDefaultNumberArray
Sets the entry's value if it does not exist.- Parameters:
defaultValue- the default value to set- Returns:
- False if the entry exists with a different type
-
setValue
Sets the entry's value.- Parameters:
value- the value that will be assigned- Returns:
- False if the table key already exists with a different type
- Throws:
IllegalArgumentException- if the value is not a known type
-
setBoolean
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setInteger
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setFloat
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setDouble
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setString
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setRaw
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setRaw
Sets the entry's value.- Parameters:
value- the value to set; will send from value.position() to value.capacity()- Returns:
- False if the entry exists with a different type
-
setRaw
Sets the entry's value.- Parameters:
value- the value to setstart- Start position of data (in buffer)len- Length of data (must be less than or equal to value.length - start)- Returns:
- False if the entry exists with a different type
-
setRaw
Sets the entry's value.- Parameters:
value- the value to setstart- Start position of data (in buffer)len- Length of data (must be less than or equal to value.capacity() - start)- Returns:
- False if the entry exists with a different type
-
setBooleanArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setBooleanArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setIntegerArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setIntegerArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setFloatArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setFloatArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setDoubleArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setDoubleArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setStringArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setNumber
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setNumberArray
Sets the entry's value.- Parameters:
value- the value to set- Returns:
- False if the entry exists with a different type
-
setPersistent
Make value persistent through program restarts. -
clearPersistent
Stop making value persistent through program restarts. -
isPersistent
Returns whether the value is persistent through program restarts.- Returns:
- True if the value is persistent.
-
unpublish
Stops publishing the entry if it's been published. -
equals
-
hashCode
-