class DumpFile

Defined at line 72 of file ../../src/lib/zxdump/dump-file.h

Each open dump file is one of these.

Public Methods

void ~DumpFile ()

Defined at line 19 of file ../../src/lib/zxdump/dump-file.cc

fit::result<Error, std::unique_ptr<DumpFile>> Open (fbl::unique_fd fd, bool try_mmap)

Map the file in if possible, falling back to reading via stdio.

Defined at line 22 of file ../../src/lib/zxdump/dump-file.cc

bool IsCompressed (ByteView header)

Returns true if the probed bytes indicate a compressed file. The buffer

is expected to be at least kHeaderProbeSize to be able to match anything.

Defined at line 11 of file ../../src/lib/zxdump/dump-file-zstd.cc

fit::result<Error, std::unique_ptr<DumpFile>> Decompress (FileRange where, ByteView header)

Return a new DumpFile that decompresses part of this one by doing

ReadEphemeral calls on it. The new DumpFile's lifetime must not exceed

this object's lifetime. The underlying object should not be used for

ReadEphemeral while the decompressor object is being used.

Defined at line 13 of file ../../src/lib/zxdump/dump-file-zstd.cc

size_t size ()

Return the size of the file. This may not be known for a streaming input,

in which case this value acts only as an upper bound.

void shrink_to_fit ()

Reduce resources when no more reading will be done but the object is kept

alive for ReadPermanent results.

fit::result<Error, ByteView> ReadPermanent (FileRange fr)

Read a range of the file, yielding a pointer that's valid as long as this

object lives. When not doing mmap, this has to copy it all in memory.

fit::result<Error, ByteView> ReadEphemeral (FileRange fr)

Read a range of the file, yielding a pointer that's only guaranteed to be

valid until the next ReadEphemeral (or ReadProbe) call on the same object.

fit::result<Error, ByteView> ReadProbe (FileRange fr)

This does ReadEphemeral (and so it invalidates past ReadEphemeral results

and vice versa), but if the dump file ends before the whole range, just

return a shorter range rather than the "truncated dump" error.

fit::result<Error, Buffer<>> ReadMemory (FileRange fr)

Read a range of the file, yielding a Buffer object whose lifetime is tied

to the lifetime of this DumpFile object. The given range is the minimum

range that must be read. If less is available, failure is returned

(possibly using the "truncated dump" error). More may be returned if it

is conveniently at hand.

size_t size_bytes ()

Defined at line 94 of file ../../src/lib/zxdump/dump-file.h