Package edu.wpi.first.util.datalog
Class DataLogRecord
java.lang.Object
edu.wpi.first.util.datalog.DataLogRecord
public class DataLogRecord extends Object
A record in the data log. May represent either a control record (entry == 0) or a data record.
Used only for reading (e.g. with DataLogReader).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataLogRecord.MetadataRecordData
Data contained in a set metadata control record as created by DataLog.setMetadata().static class
DataLogRecord.StartRecordData
Data contained in a start control record as created by DataLog.start() when writing the log. -
Method Summary
Modifier and Type Method Description boolean
getBoolean()
Decodes a data record as a boolean.boolean[]
getBooleanArray()
Decodes a data record as a boolean array.double
getDouble()
Decodes a data record as a double.double[]
getDoubleArray()
Decodes a data record as a double array.DoubleBuffer
getDoubleBuffer()
Decodes a data record as a double array.int
getEntry()
Gets the entry ID.int
getFinishEntry()
Decodes a finish control record.float
getFloat()
Decodes a data record as a float.float[]
getFloatArray()
Decodes a data record as a float array.FloatBuffer
getFloatBuffer()
Decodes a data record as a float array.long
getInteger()
Decodes a data record as an integer.long[]
getIntegerArray()
Decodes a data record as an integer array.LongBuffer
getIntegerBuffer()
Decodes a data record as an integer array.byte[]
getRaw()
Gets the raw data.ByteBuffer
getRawBuffer()
Gets the raw data.DataLogRecord.MetadataRecordData
getSetMetadataData()
Decodes a set metadata control record.int
getSize()
Gets the size of the raw data.DataLogRecord.StartRecordData
getStartData()
Decodes a start control record.String
getString()
Decodes a data record as a string.String[]
getStringArray()
Decodes a data record as a string array.long
getTimestamp()
Gets the record timestamp.boolean
isControl()
Returns true if the record is a control record.boolean
isFinish()
Returns true if the record is a finish control record.boolean
isSetMetadata()
Returns true if the record is a set metadata control record.boolean
isStart()
Returns true if the record is a start control record.
-
Method Details
-
getEntry
Gets the entry ID.- Returns:
- entry ID
-
getTimestamp
Gets the record timestamp.- Returns:
- Timestamp, in integer microseconds
-
getSize
Gets the size of the raw data.- Returns:
- size
-
getRaw
Gets the raw data. Use the GetX functions to decode based on the data type in the entry's start record.- Returns:
- byte array
-
getRawBuffer
Gets the raw data. Use the GetX functions to decode based on the data type in the entry's start record.- Returns:
- byte buffer
-
isControl
Returns true if the record is a control record.- Returns:
- True if control record, false if normal data record.
-
isStart
Returns true if the record is a start control record. Use GetStartData() to decode the contents.- Returns:
- True if start control record, false otherwise.
-
isFinish
Returns true if the record is a finish control record. Use GetFinishEntry() to decode the contents.- Returns:
- True if finish control record, false otherwise.
-
isSetMetadata
Returns true if the record is a set metadata control record. Use GetSetMetadataData() to decode the contents.- Returns:
- True if set metadata control record, false otherwise.
-
getStartData
Decodes a start control record.- Returns:
- start record decoded data
- Throws:
InputMismatchException
- on error
-
getFinishEntry
Decodes a finish control record.- Returns:
- finish record entry ID
- Throws:
InputMismatchException
- on error
-
getSetMetadataData
Decodes a set metadata control record.- Returns:
- set metadata record decoded data
- Throws:
InputMismatchException
- on error
-
getBoolean
Decodes a data record as a boolean. Note if the data type (as indicated in the corresponding start control record for this entry) is not "boolean", invalid results may be returned.- Returns:
- boolean value
- Throws:
InputMismatchException
- on error
-
getInteger
Decodes a data record as an integer. Note if the data type (as indicated in the corresponding start control record for this entry) is not "int64", invalid results may be returned.- Returns:
- integer value
- Throws:
InputMismatchException
- on error
-
getFloat
Decodes a data record as a float. Note if the data type (as indicated in the corresponding start control record for this entry) is not "float", invalid results may be returned.- Returns:
- float value
- Throws:
InputMismatchException
- on error
-
getDouble
Decodes a data record as a double. Note if the data type (as indicated in the corresponding start control record for this entry) is not "double", invalid results may be returned.- Returns:
- double value
- Throws:
InputMismatchException
- on error
-
getString
Decodes a data record as a string. Note if the data type (as indicated in the corresponding start control record for this entry) is not "string", invalid results may be returned.- Returns:
- string value
-
getBooleanArray
Decodes a data record as a boolean array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "boolean[]", invalid results may be returned.- Returns:
- boolean array
-
getIntegerArray
Decodes a data record as an integer array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "int64[]", invalid results may be returned.- Returns:
- integer array
- Throws:
InputMismatchException
- on error
-
getIntegerBuffer
Decodes a data record as an integer array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "int64[]", invalid results may be returned.- Returns:
- integer buffer
- Throws:
InputMismatchException
- on error
-
getFloatArray
Decodes a data record as a float array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "float[]", invalid results may be returned.- Returns:
- float array
- Throws:
InputMismatchException
- on error
-
getFloatBuffer
Decodes a data record as a float array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "float[]", invalid results may be returned.- Returns:
- float buffer
- Throws:
InputMismatchException
- on error
-
getDoubleArray
Decodes a data record as a double array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "double[]", invalid results may be returned.- Returns:
- double array
- Throws:
InputMismatchException
- on error
-
getDoubleBuffer
Decodes a data record as a double array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "double[]", invalid results may be returned.- Returns:
- double buffer
- Throws:
InputMismatchException
- on error
-
getStringArray
Decodes a data record as a string array. Note if the data type (as indicated in the corresponding start control record for this entry) is not "string[]", invalid results may be returned.- Returns:
- string array
- Throws:
InputMismatchException
- on error
-