Package lcm.logging

# Class Log

java.lang.Object
lcm.logging.Log

public class Log extends Object
A class for reading and writing LCM log files.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`Log.Event`
Represents a single received LCM message.

## Constructor Summary

Constructors
Constructor
Description
`Log(String path, String mode)`
Opens a log file for reading or writing.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Closes the log file and releases and system resources used by it.
`void`
`flush()`
Flush any unwritten data to the underlying file descriptor.
`String`
`getPath()`
Retrieves the path to the log file.
`double`
`getPositionFraction()`
`Log.Event`
`readNext()`
Reads the next event in the log file
`void`
`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`
`write(Log.Event e)`
Writes an event to the log file.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Log

public Log(String path, String mode) throws IOException
Opens a log file for reading or writing.

Parameters:
  `path` - the filename to open
  `mode` - Specifies the access mode, must be one of "r", "rw", "rws", or "rwd". See `RandomAccessFile` for more detail.
Throws:
  `IOException`

## Method Details

### getPath

public String getPath()
Retrieves the path to the log file.

Returns:
  the path to the log file

### flush

public void flush() throws IOException
Flush any unwritten data to the underlying file descriptor.

Throws:
  `IOException`

### readNext

public Log.Event readNext() throws IOException
Reads the next event in the log file

Throws:
  `EOFException` - if the end of the file has been reached.
  `IOException`

### getPositionFraction

public double getPositionFraction() throws IOException

Throws:
  `IOException`

### seekPositionFraction

public void seekPositionFraction(double frac) throws IOException
Seek to a position in the log file, specified by a fraction.

Parameters:
  `frac` - a number in the range [0, 1)
Throws:
  `IOException`

### write

public void write(Log.Event e) throws IOException
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

public void write(long utime, String channel, LCMEncodable msg) throws IOException
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

public void close() throws IOException
Closes the log file and releases and system resources used by it.

Throws:
  `IOException`