Crashpad

Public Member Functions | List of all members
crashpad::FileReader Class Reference

A file reader implementation that wraps traditional system file operations on files accessed through the filesystem. More...

`#include "util/file/file_reader.h"`

Inheritance diagram for crashpad::FileReader:

## Public Member Functions
bool | Open (const base::FilePath &path)
| Wraps LoggingOpenFileForRead(). More...
void | Close ()
| Wraps CheckedCloseHandle(). More...
FileOperationResult | Read (void *data, size_t size) override
| Wraps ReadFile(), or provides an implementation with identical semantics. More...
FileOffset | Seek (FileOffset offset, int whence) override
| Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics. More...
Public Member Functions inherited from crashpad::FileReaderInterface
bool | ReadExactly (void *data, size_t size)
| Wraps Read(), ensuring that the read succeeded and exactly size bytes were read. More...
Public Member Functions inherited from crashpad::FileSeekerInterface
FileOffset | SeekGet ()
| Wraps Seek(), using `SEEK_CUR` to obtain the file’s current position. More...
bool | SeekSet (FileOffset offset)
| Wraps Seek(), using `SEEK_SET`, ensuring that the seek succeeded and the file is positioned as desired. More...

## Detailed Description

A file reader implementation that wraps traditional system file operations on files accessed through the filesystem.

## Member Function Documentation

## ◆ Close()

void crashpad::FileReader::Close | ( |  | ) |

Wraps CheckedCloseHandle().

Note
  It is only valid to call this method on an object that has had a successful Open() that has not yet been matched by a subsequent call to this method.

## ◆ Open()

bool crashpad::FileReader::Open | ( | const base::FilePath & | path | ) |

Wraps LoggingOpenFileForRead().

Returns
  `true` if the operation succeeded, `false` if it failed, with an error message logged.

Note
  After a successful call, this method cannot be called again until after Close().

## ◆ Read()

FileOperationResult crashpad::FileReader::Read | ( | void * | data,
|  | size_t | size
| ) |  |
| override virtual

Wraps ReadFile(), or provides an implementation with identical semantics.

Returns
  The number of bytes actually read if the operation succeeded, which may be `0` or any positive value less than or equal to size. `-1` if the operation failed, with an error message logged.

Note
  It is only valid to call this method between a successful Open() and a Close().

Implements crashpad::FileReaderInterface.

## ◆ Seek()

FileOffset crashpad::FileReader::Seek | ( | FileOffset | offset,
|  | int | whence
| ) |  |
| override virtual

Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics.

Returns
  The return value of LoggingSeekFile(). `-1` on failure, with an error message logged.

Note
  It is only valid to call this method between a successful Open() and a Close().

Implements crashpad::FileSeekerInterface.

The documentation for this class was generated from the following files:

- util/file/file_reader.h
- util/file/file_reader.cc