Class DataLogReader

java.lang.Object
org.wpilib.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 Details

    • DataLogReader

      public DataLogReader(ByteBuffer buffer)
      Constructs from the bytes between the byte buffer's current position and limit. The reader does not modify the buffer's position, limit, or byte order.
      Parameters:
      buffer - byte buffer
    • DataLogReader

      public DataLogReader(String filename) throws IOException
      Constructs from a file.
      Parameters:
      filename - filename
      Throws:
      IOException - if unable to open/read file
  • Method Details

    • isValid

      public boolean isValid()
      Returns true if the data log is valid (e.g. has a valid header).
      Returns:
      True if valid, false otherwise
    • getVersion

      public short 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

      public String getExtraHeader()
      Gets the extra header data.
      Returns:
      Extra header data
    • forEach

      public void forEach(Consumer<? super DataLogRecord> action)
      Specified by:
      forEach in interface Iterable<DataLogRecord>
    • iterator

      public DataLogIterator iterator()
      Specified by:
      iterator in interface Iterable<DataLogRecord>