Crashpad

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

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

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

Inheritance diagram for crashpad::FileWriter:

## Public Member Functions
bool | Open (const base::FilePath &path, FileWriteMode write_mode, FilePermissions permissions)
| Wraps LoggingOpenFileForWrite(). More...
void | Close ()
| Wraps CheckedCloseHandle(). More...
bool | Write (const void *data, size_t size) override
| Wraps LoggingWriteFile(), or provides an implementation with identical semantics. More...
bool | WriteIoVec (std::vector< WritableIoVec > *iovecs) override
| Wraps `writev()` on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around Write(). 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::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 writer implementation that wraps traditional system file operations on files accessed through the filesystem.

## Member Function Documentation

## ◆ Close()

void crashpad::FileWriter::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::FileWriter::Open | ( | const base::FilePath & | path,
|  | FileWriteMode | write_mode,
|  | FilePermissions | permissions
| ) |  |

Wraps LoggingOpenFileForWrite().

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().

## ◆ Seek()

FileOffset crashpad::FileWriter::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.

## ◆ Write()

bool crashpad::FileWriter::Write | ( | const void * | data,
|  | size_t | size
| ) |  |
| override virtual

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

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

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

Implements crashpad::FileWriterInterface.

## ◆ WriteIoVec()

bool crashpad::FileWriter::WriteIoVec | ( | std::vector< WritableIoVec > * | iovecs | ) |
| override virtual

Wraps `writev()` on POSIX or provides an alternate implementation with identical semantics. This method will write entire buffers, continuing after a short write or after being interrupted. On non-POSIX this is a simple wrapper around Write().

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

Note
  The contents of iovecs are undefined when this method returns.
  It is only valid to call this method between a successful Open() and a Close().

Implements crashpad::FileWriterInterface.

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

- util/file/file_writer.h
- util/file/file_writer.cc