Crashpad
|
A file reader backed by a standard input/output FILE*
.
More...
#include "util/file/file_reader.h"
Public Member Functions | |
WeakStdioFileReader (FILE *file) | |
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... | |
![]() | |
bool | ReadExactly (void *data, size_t size) |
Wraps Read(), ensuring that the read succeeded and exactly size bytes were read. More... | |
![]() | |
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... | |
A file reader backed by a standard input/output FILE*
.
This class accepts an already-open FILE*
. It is not responsible for opening or closing this FILE*
. Users of this class must ensure that the FILE*
is closed appropriately elsewhere. Objects of this class may be used to read from FILE*
objects not associated with filesystem-based files, although special attention should be paid to the Seek() method, which may not function on FILE*
objects that do not refer to disk-based files.
This class is expected to be used when other code is responsible for opening FILE*
objects and already provides FILE*
objects. A good use would be a WeakStdioFileReader for stdin
.
|
overridevirtual |
Wraps ReadFile(), or provides an implementation with identical semantics.
0
or any positive value less than or equal to size. -1
if the operation failed, with an error message logged. Implements crashpad::FileReaderInterface.
|
overridevirtual |
Wraps LoggingSeekFile() or provides an alternate implementation with identical semantics.
-1
on failure, with an error message logged.FILE*
objects referring to disk-based files. Implements crashpad::FileSeekerInterface.