Package edu.wpi.first.util.datalog
Class DataLogReader
java.lang.Object
edu.wpi.first.util.datalog.DataLogReader
- All Implemented Interfaces:
Iterable<DataLogRecord>
Data log reader (reads logs written by the DataLog class).
-
Constructor Summary
ConstructorDescriptionDataLogReader
(String filename) Constructs from a file.DataLogReader
(ByteBuffer buffer) Constructs from a byte buffer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
forEach
(Consumer<? super DataLogRecord> action) Gets the extra header data.short
Gets the data log version.boolean
isValid()
Returns true if the data log is valid (e.g.iterator()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
DataLogReader
Constructs from a byte buffer.- Parameters:
buffer
- byte buffer
-
DataLogReader
Constructs from a file.- Parameters:
filename
- filename- Throws:
IOException
- if unable to open/read file
-
-
Method Details
-
isValid
Returns true if the data log is valid (e.g. has a valid header).- Returns:
- True if valid, false otherwise
-
getVersion
Gets the data log version. Returns 0 if data log is invalid.- Returns:
- Version number; most significant byte is major, least significant is minor (so version 1.0 will be 0x0100)
-
getExtraHeader
Gets the extra header data.- Returns:
- Extra header data
-
forEach
- Specified by:
forEach
in interfaceIterable<DataLogRecord>
-
iterator
- Specified by:
iterator
in interfaceIterable<DataLogRecord>
-