class PseudoFile

Defined at line 34 of file ../../sdk/lib/vfs/cpp/pseudo_file.h

Buffered pseudo-file.

This variant is optimized for incrementally reading and writing properties which are larger than

can typically be read or written by the client in a single I/O transaction.

In read mode, the pseudo-file invokes its read handler when the file is opened and retains the

content in an output buffer which the client incrementally reads from and can seek within.

In write mode, the client incrementally writes into and seeks within an input buffer which the

pseudo-file delivers as a whole to the write handler when the file is closed. Truncation is also

supported.

Each client has its own separate output and input buffers. Writing into the output buffer does

not affect the contents of the client's input buffer or that of any other client. Changes to the

underlying state of the pseudo-file are not observed by the client until it closes and re-opens

the file.

This class is thread-safe.

Public Methods

void PseudoFile (size_t max_file_size, ReadHandler read_handler, WriteHandler write_handler)

Creates a buffered pseudo-file.

`read_handler` cannot be null. If the `write_handler` is null, then the pseudo-file is

considered not writable. `max_file_size` determines the maximum number of bytes which can be

written to and read from the pseudo-file's input buffer when it it opened for writing/reading.

Defined at line 47 of file ../../sdk/lib/vfs/cpp/pseudo_file.h

zx_status_t Serve (fuchsia_io::Flags flags, fidl::ServerEnd<fuchsia_io::File> server_end, async_dispatcher_t * dispatcher)

Serve a new connection to this pseudo-file on `server_end` using specified `flags`.

This method must only be used with a single-threaded asynchronous dispatcher. If `dispatcher`

is `nullptr`, the current thread's default dispatcher will be used via

`async_get_default_dispatcher`. The same `dispatcher` must be used if multiple connections are

served for the same node, otherwise `ZX_ERR_INVALID_ARGS` will be returned.

Defined at line 57 of file ../../sdk/lib/vfs/cpp/pseudo_file.h