blob: b2cf7dbf230f1da6842f1bd36227961f91d3c30a [file] [log] [blame] [view]
# PseudoFile class
*[<Null safety>](https://dart.dev/null-safety)*
<p>A <a href="../package-fuchsia_vfs_vfs/PseudoFile-class.md">PseudoFile</a> is a file-like object whose content is generated and modified
dynamically on-the-fly by invoking handler functions rather than being
directly persisted as a sequence of bytes.</p>
<p>This class is designed to allow programs to publish read-only,
or read-write properties such as configuration options, debug flags,
and dumps of internal state which may change dynamically.</p>
<p>Although <a href="../package-fuchsia_vfs_vfs/PseudoFile-class.md">PseudoFile</a> usually contain text, they can also be used for binary
data.</p>
<p>Read callback, is called when the connection to the file is opened and
pre-populates a buffer that will be used to when serving this file content
over this particular connection.</p>
<p>Write callback, if any, is called when the connection is closed if the file
content was ever modified while the connection was open.
Modifications are: <code>fidl_fuchsia_io.File#write()</code> calls or opening a file
for writing with the <code>OpenFlags.truncate</code> flag set.</p>
**Inheritance**
- Object
- [Vnode](../package-fuchsia_vfs_vfs/Vnode-class.md)
- PseudoFile
**Implementers**
- [PseudoVmoFile](../package-fuchsia_vfs_vfs/PseudoVmoFile-class.md)
- [VmoFile](../package-fuchsia_vfs_vfs/VmoFile-class.md)
## Constructors
[PseudoFile.readOnly](../package-fuchsia_vfs_vfs/PseudoFile/PseudoFile.readOnly.md) ([ReadFn](../package-fuchsia_vfs_vfs/ReadFn.md)? _readFn)
Creates a new read-only <a href="../package-fuchsia_vfs_vfs/PseudoFile-class.md">PseudoFile</a> backed by the specified read handler.
[PseudoFile.readOnlyStr](../package-fuchsia_vfs_vfs/PseudoFile/PseudoFile.readOnlyStr.md) ([ReadFnStr](../package-fuchsia_vfs_vfs/ReadFnStr.md) fn)
See <code>#readOnly()</code>. Wraps the callback, allowing it to return a String instead of a Uint8List,
but otherwise behaves identical to <code>#readOnly()</code>.
[PseudoFile.readWrite](../package-fuchsia_vfs_vfs/PseudoFile/PseudoFile.readWrite.md) (int _capacity, [ReadFn](../package-fuchsia_vfs_vfs/ReadFn.md)? _readFn, [WriteFn](../package-fuchsia_vfs_vfs/WriteFn.md)? _writeFn)
Creates new <a href="../package-fuchsia_vfs_vfs/PseudoFile-class.md">PseudoFile</a> backed by the specified read and write handlers.
[PseudoFile.readWriteStr](../package-fuchsia_vfs_vfs/PseudoFile/PseudoFile.readWriteStr.md) (int _capacity, [ReadFnStr](../package-fuchsia_vfs_vfs/ReadFnStr.md) rfn, [WriteFnStr](../package-fuchsia_vfs_vfs/WriteFnStr.md) wfn)
See <code>#readWrite()</code>. Wraps the read callback, allowing it to return a <code>String</code> instead of a
<code>Uint8List</code>. Wraps the write callback, only allowing valid UTF-8 content to be written into
the file. Written bytes are converted into a string instance, and the passed to the handler.
In every other aspect behaves just like <code>#readWrite()</code>.
## Properties
##### [hashCode](../package-fuchsia_vfs_vfs/Vnode/hashCode.md) &#8594; int
The hash code for this object.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
##### [runtimeType](../package-fuchsia_vfs_vfs/Vnode/runtimeType.md) &#8594; Type
A representation of the runtime type of the object.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
## Methods
##### [close](../package-fuchsia_vfs_vfs/PseudoFile/close.md)() void
Close this node and all of its bindings and children.
_<span class="feature override">override</span>_
##### [connect](../package-fuchsia_vfs_vfs/PseudoFile/connect.md)(dynamic flags, int mode, [InterfaceRequest](../package-fidl_fidl/InterfaceRequest-class.md) request, [dynamic parentFlags]) int
Connects to this instance of <a href="../package-fuchsia_vfs_vfs/PseudoFile-class.md">PseudoFile</a> and serves <code>fidl_fuchsia_io.File</code> over fidl.
_<span class="feature override">override</span>_
##### [describe2](../package-fuchsia_vfs_vfs/PseudoFile/describe2.md)() dynamic
##### [describeDeprecated](../package-fuchsia_vfs_vfs/PseudoFile/describeDeprecated.md)() dynamic
##### [filterForNodeReference](../package-fuchsia_vfs_vfs/Vnode/filterForNodeReference.md)(dynamic flags) dynamic
Filter flags when <code>OpenFlags.nodeReference</code> is passed.
This will maintain compatibility with c++ layer.
_<span class="feature inherited">inherited</span>_
##### [getBackingMemory](../package-fuchsia_vfs_vfs/PseudoFile/getBackingMemory.md)(dynamic flags) [Vmo](../zircon/Vmo-class.md)
##### [getConnectionInfo](../package-fuchsia_vfs_vfs/PseudoFile/getConnectionInfo.md)() dynamic
##### [inodeNumber](../package-fuchsia_vfs_vfs/PseudoFile/inodeNumber.md)() int
Inode number as defined in fuchsia.io.
_<span class="feature override">override</span>_
##### [noSuchMethod](../package-fuchsia_vfs_vfs/Vnode/noSuchMethod.md)(Invocation invocation) dynamic
Invoked when a non-existent method or property is accessed.
_<span class="feature inherited">inherited</span>_
##### [open](../package-fuchsia_vfs_vfs/Vnode/open.md)(dynamic flags, int mode, String path, [InterfaceRequest](../package-fidl_fidl/InterfaceRequest-class.md) request, [dynamic parentFlags]) void
This function is called from <code>fidl_fuchsia_io.Directory#open</code>.
This function parses path and opens correct node.
_<span class="feature inherited">inherited</span>_
##### [sendErrorEvent](../package-fuchsia_vfs_vfs/Vnode/sendErrorEvent.md)(dynamic flags, int status, [InterfaceRequest](../package-fidl_fidl/InterfaceRequest-class.md) request) void
Create a error node to send onOpen event with failure status.
_<span class="feature inherited">inherited</span>_
##### [toString](../package-fuchsia_vfs_vfs/Vnode/toString.md)() String
A string representation of this object.
_<span class="feature inherited">inherited</span>_
##### [type](../package-fuchsia_vfs_vfs/PseudoFile/type.md)() dynamic
_<span class="feature override">override</span>_
## Operators
##### [operator ==](../package-fuchsia_vfs_vfs/Vnode/operator_equals.md)(Object other) bool
The equality operator.
_<span class="feature inherited">inherited</span>_