Package edu.wpi.first.util.datalog
Class DataLogReader
java.lang.Object
edu.wpi.first.util.datalog.DataLogReader
- All Implemented Interfaces:
Iterable<DataLogRecord>
public class DataLogReader extends Object implements Iterable<DataLogRecord>
Data log reader (reads logs written by the DataLog class).
-
Constructor Summary
Constructors Constructor Description DataLogReader(String filename)
Constructs from a file.DataLogReader(ByteBuffer buffer)
Constructs from a byte buffer. -
Method Summary
Modifier and Type Method Description void
forEach(Consumer<? super DataLogRecord> action)
String
getExtraHeader()
Gets the extra header data.short
getVersion()
Gets the data log version.boolean
isValid()
Returns true if the data log is valid (e.g.DataLogIterator
iterator()
-
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>
-