Package lcm.logging
Class Log
java.lang.Object
lcm.logging.Log
A class for reading and writing LCM log files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a single received LCM message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the log file and releases and system resources used by it.void
flush()
Flush any unwritten data to the underlying file descriptor.getPath()
Retrieves the path to the log file.double
readNext()
Reads the next event in the log filevoid
seekPositionFraction
(double frac) Seek to a position in the log file, specified by a fraction.void
write
(long utime, String channel, LCMEncodable msg) A convenience method for write.void
Writes an event to the log file.
-
Constructor Details
-
Log
Opens a log file for reading or writing.- Parameters:
path
- the filename to openmode
- Specifies the access mode, must be one of "r", "rw", "rws", or "rwd". SeeRandomAccessFile
for more detail.- Throws:
IOException
-
-
Method Details
-
getPath
Retrieves the path to the log file.- Returns:
- the path to the log file
-
flush
Flush any unwritten data to the underlying file descriptor.- Throws:
IOException
-
readNext
Reads the next event in the log file- Throws:
EOFException
- if the end of the file has been reached.IOException
-
getPositionFraction
- Throws:
IOException
-
seekPositionFraction
Seek to a position in the log file, specified by a fraction.- Parameters:
frac
- a number in the range [0, 1)- Throws:
IOException
-
write
Writes an event to the log file. The user is responsible for filling in the eventNumber field, which should be sequentially increasing integers starting with 0.- Throws:
IOException
-
write
A convenience method for write. It internally manages the eventNumber field, and so calls to this method should not be mixed with calls to the other write methods.- Throws:
IOException
-
close
Closes the log file and releases and system resources used by it.- Throws:
IOException
-