Écrire count octets depuis le tampon donné vers le flux.
Détails
Paramètres
stream
Flux dans lequel écrire.
buf
Tampon à lire.
count
Nombre d'octets à écrire.
Renvoie
"true" en cas de réussite, "false" en cas d'erreur d'écriture.
Le contenu et les exemples de code de cette page sont soumis aux licences décrites dans la Licence de contenu. Java et OpenJDK sont des marques ou des marques déposées d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/27 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/27 (UTC)."],[],[],null,["# tuningfork::VectorStream Struct Reference\n\ntuningfork::VectorStream\n========================\n\n`#include \u003cprotobuf_nano_util.h\u003e`\n\nA view on the vector provided in `vec`.\n\nSummary\n-------\n\nNo ownership is taken.\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `vec` | Example usage: ```css+lasso std::vector\u003cuint8_t\u003e v; VectorStream str {&v, 0}; pb_ostream_t stream = {VectorStream::Write, &str, SIZE_MAX, 0}; pb_encode(&stream, ...); ``` | |\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| [it](#structtuningfork_1_1_vector_stream_1a15e8cd3ec11280c7e7060563a197d195) | `size_t` The current position in the vector while decoding or encoding. |\n| [vec](#structtuningfork_1_1_vector_stream_1a3fc88833828997802f63f25ecfc9596e) | `std::vector\u003c uint8_t \u003e *` A vector of bytes that must be valid while `Read` or `Write` are called. |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| [Read](#structtuningfork_1_1_vector_stream_1add5291b48820efba50df20aed1acf095)`(pb_istream_t *stream, uint8_t *buf, size_t count)` | `bool` Read `count` bytes from the stream to the given buffer. |\n| [Write](#structtuningfork_1_1_vector_stream_1a9a25c5eebeb2335dfcb069e247784cf8)`(pb_ostream_t *stream, const uint8_t *buf, size_t count)` | `bool` Write `count` bytes from the given buffer to the stream. |\n\nPublic attributes\n-----------------\n\n### it\n\n```scdoc\nsize_t tuningfork::VectorStream::it\n``` \nThe current position in the vector while decoding or encoding. \n\n### vec\n\n```scdoc\nstd::vector\u003c uint8_t \u003e * tuningfork::VectorStream::vec\n``` \nA vector of bytes that must be valid while `Read` or `Write` are called.\n\nThe vector will be resized as needed by `Write`.\n\nPublic static functions\n-----------------------\n\n### Read\n\n```scdoc\nbool tuningfork::VectorStream::Read(\n pb_istream_t *stream,\n uint8_t *buf,\n size_t count\n)\n``` \nRead `count` bytes from the stream to the given buffer.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |----------|------------------------------| | `stream` | The stream to read from. | | `buf` | The buffer to write to. | | `count` | The number of bytes to read. | |\n| **Returns** | true if successful, false on a read error. |\n\n### Write\n\n```gdscript\nbool tuningfork::VectorStream::Write(\n pb_ostream_t *stream,\n const uint8_t *buf,\n size_t count\n)\n``` \nWrite `count` bytes from the given buffer to the stream.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |----------|-------------------------------| | `stream` | The stream to write to. | | `buf` | The buffer to read from. | | `count` | The number of bytes to write. | |\n| **Returns** | true if successful, false on a write error. |"]]