Menulis byte count dari buffering yang diberikan ke streaming.
Detail
Parameter
stream
Streaming untuk ditulisi.
buf
Buffering untuk dibaca.
count
Jumlah byte untuk ditulisi.
Hasil
true jika berhasil, false pada error tulis.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2023-09-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2023-09-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. |"]]