CBFSVaultStream Type

Syntax

CBFSVaultStream (declared in qcbfsvault.h)

Remarks

The CBFSVaultStream type is returned by some of the CBVault class's methods. All stream types in CBFS Vault share a common API, inherited from Qt's QIODevice class, documented below. As with any class derived from QIODevice, the CBFSVaultStream type's open method must be called before it can be used.

Note that, for brevity, many of the members offered by QIODevice are not documented here; please refer to the Qt documentation for more information.

Properties

isReadable Whether the stream supports reading.

bool isReadable();
isWritable Whether the stream supports writing.

bool isWriteable();
pos Gets the current position within the stream.

qint64 pos();
size Gets the length of the stream, in bytes.

qint64 size();

Methods

close Closes the stream. Has no effect if the stream is already closed.

void close();

Closed streams can be reopened using the open method.

flush Forces all data held by the stream's buffers to be written out to storage. Has no effect if the stream is closed.

void flush();
open Opens the stream for use.

bool open(QIODevice::OpenMode mode);

Returns true if the stream is successfully opened in the specified mode; false otherwise.

read Reads a sequence of bytes from the stream and advances the current position within the stream by the number of bytes read.

qint64 read(char *data, qint64 maxSize);
QByteArray read(qint64 maxSize);

Up to maxSize bytes will be read from the stream. Fewer than maxSize bytes may be read if fewer than maxSize bytes are available. The first variant of this method reads the bytes into the buffer pointed to by data and returns the number of bytes read; the second variant returns the bytes as a QByteArray.

If an error occurs, the first variant of this method returns -1; the second variant returns an empty QByteArray.

readAll Reads and returns all bytes available in the stream from the current position onwards.

QByteArray readAll();
seek Sets the current position within the stream.

bool seek(qint64 pos);

Returns true if the seek operation was successful; false otherwise.

write Writes a sequence of bytes to the stream and advances the current position within the stream by the number of bytes written.

qint64 write(const char *data, qint64 maxSize);
qint64 write(const char *data);
qint64 write(const QByteArray &byteArray);

The first variant of this method writes up to maxSize bytes from the buffer pointed to by data to the stream. The second variant writes data from a zero-terminated string of 8-bit characters to the stream. The third variant writes the contents of byteArray to the stream.

All variants of this method return the number of bytes actually written to the stream, or -1 if an error occurred.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Vault 2020 Qt Edition - Version 20.0 [Build 7982]