class_streampeer.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/StreamPeer.xml.
  6. .. _class_StreamPeer:
  7. StreamPeer
  8. ==========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`StreamPeerBuffer<class_StreamPeerBuffer>`, :ref:`StreamPeerExtension<class_StreamPeerExtension>`, :ref:`StreamPeerGZIP<class_StreamPeerGZIP>`, :ref:`StreamPeerTCP<class_StreamPeerTCP>`, :ref:`StreamPeerTLS<class_StreamPeerTLS>`
  11. Abstract base class for interacting with streams.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. StreamPeer is an abstract base class mostly used for stream-based protocols (such as TCP). It provides an API for sending and receiving data through streams as raw data or strings.
  16. \ **Note:** When exporting to Android, make sure to enable the ``INTERNET`` permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +-------------------------+---------------------------------------------------------+-----------+
  23. | :ref:`bool<class_bool>` | :ref:`big_endian<class_StreamPeer_property_big_endian>` | ``false`` |
  24. +-------------------------+---------------------------------------------------------+-----------+
  25. .. rst-class:: classref-reftable-group
  26. Methods
  27. -------
  28. .. table::
  29. :widths: auto
  30. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_8<class_StreamPeer_method_get_8>`\ (\ ) |
  32. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`get_16<class_StreamPeer_method_get_16>`\ (\ ) |
  34. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`get_32<class_StreamPeer_method_get_32>`\ (\ ) |
  36. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`get_64<class_StreamPeer_method_get_64>`\ (\ ) |
  38. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`get_available_bytes<class_StreamPeer_method_get_available_bytes>`\ (\ ) |const| |
  40. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Array<class_Array>` | :ref:`get_data<class_StreamPeer_method_get_data>`\ (\ bytes\: :ref:`int<class_int>`\ ) |
  42. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`float<class_float>` | :ref:`get_double<class_StreamPeer_method_get_double>`\ (\ ) |
  44. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`float<class_float>` | :ref:`get_float<class_StreamPeer_method_get_float>`\ (\ ) |
  46. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`float<class_float>` | :ref:`get_half<class_StreamPeer_method_get_half>`\ (\ ) |
  48. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Array<class_Array>` | :ref:`get_partial_data<class_StreamPeer_method_get_partial_data>`\ (\ bytes\: :ref:`int<class_int>`\ ) |
  50. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`String<class_String>` | :ref:`get_string<class_StreamPeer_method_get_string>`\ (\ bytes\: :ref:`int<class_int>` = -1\ ) |
  52. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_u8<class_StreamPeer_method_get_u8>`\ (\ ) |
  54. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`get_u16<class_StreamPeer_method_get_u16>`\ (\ ) |
  56. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_u32<class_StreamPeer_method_get_u32>`\ (\ ) |
  58. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`get_u64<class_StreamPeer_method_get_u64>`\ (\ ) |
  60. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`String<class_String>` | :ref:`get_utf8_string<class_StreamPeer_method_get_utf8_string>`\ (\ bytes\: :ref:`int<class_int>` = -1\ ) |
  62. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Variant<class_Variant>` | :ref:`get_var<class_StreamPeer_method_get_var>`\ (\ allow_objects\: :ref:`bool<class_bool>` = false\ ) |
  64. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`put_8<class_StreamPeer_method_put_8>`\ (\ value\: :ref:`int<class_int>`\ ) |
  66. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`put_16<class_StreamPeer_method_put_16>`\ (\ value\: :ref:`int<class_int>`\ ) |
  68. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`put_32<class_StreamPeer_method_put_32>`\ (\ value\: :ref:`int<class_int>`\ ) |
  70. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  71. | |void| | :ref:`put_64<class_StreamPeer_method_put_64>`\ (\ value\: :ref:`int<class_int>`\ ) |
  72. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`put_data<class_StreamPeer_method_put_data>`\ (\ data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
  74. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  75. | |void| | :ref:`put_double<class_StreamPeer_method_put_double>`\ (\ value\: :ref:`float<class_float>`\ ) |
  76. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  77. | |void| | :ref:`put_float<class_StreamPeer_method_put_float>`\ (\ value\: :ref:`float<class_float>`\ ) |
  78. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  79. | |void| | :ref:`put_half<class_StreamPeer_method_put_half>`\ (\ value\: :ref:`float<class_float>`\ ) |
  80. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Array<class_Array>` | :ref:`put_partial_data<class_StreamPeer_method_put_partial_data>`\ (\ data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |
  82. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`put_string<class_StreamPeer_method_put_string>`\ (\ value\: :ref:`String<class_String>`\ ) |
  84. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`put_u8<class_StreamPeer_method_put_u8>`\ (\ value\: :ref:`int<class_int>`\ ) |
  86. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`put_u16<class_StreamPeer_method_put_u16>`\ (\ value\: :ref:`int<class_int>`\ ) |
  88. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  89. | |void| | :ref:`put_u32<class_StreamPeer_method_put_u32>`\ (\ value\: :ref:`int<class_int>`\ ) |
  90. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  91. | |void| | :ref:`put_u64<class_StreamPeer_method_put_u64>`\ (\ value\: :ref:`int<class_int>`\ ) |
  92. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  93. | |void| | :ref:`put_utf8_string<class_StreamPeer_method_put_utf8_string>`\ (\ value\: :ref:`String<class_String>`\ ) |
  94. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  95. | |void| | :ref:`put_var<class_StreamPeer_method_put_var>`\ (\ value\: :ref:`Variant<class_Variant>`, full_objects\: :ref:`bool<class_bool>` = false\ ) |
  96. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  97. .. rst-class:: classref-section-separator
  98. ----
  99. .. rst-class:: classref-descriptions-group
  100. Property Descriptions
  101. ---------------------
  102. .. _class_StreamPeer_property_big_endian:
  103. .. rst-class:: classref-property
  104. :ref:`bool<class_bool>` **big_endian** = ``false`` :ref:`🔗<class_StreamPeer_property_big_endian>`
  105. .. rst-class:: classref-property-setget
  106. - |void| **set_big_endian**\ (\ value\: :ref:`bool<class_bool>`\ )
  107. - :ref:`bool<class_bool>` **is_big_endian_enabled**\ (\ )
  108. If ``true``, this **StreamPeer** will using big-endian format for encoding and decoding.
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Method Descriptions
  113. -------------------
  114. .. _class_StreamPeer_method_get_8:
  115. .. rst-class:: classref-method
  116. :ref:`int<class_int>` **get_8**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_8>`
  117. Gets a signed byte from the stream.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_StreamPeer_method_get_16:
  121. .. rst-class:: classref-method
  122. :ref:`int<class_int>` **get_16**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_16>`
  123. Gets a signed 16-bit value from the stream.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_StreamPeer_method_get_32:
  127. .. rst-class:: classref-method
  128. :ref:`int<class_int>` **get_32**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_32>`
  129. Gets a signed 32-bit value from the stream.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_StreamPeer_method_get_64:
  133. .. rst-class:: classref-method
  134. :ref:`int<class_int>` **get_64**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_64>`
  135. Gets a signed 64-bit value from the stream.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_StreamPeer_method_get_available_bytes:
  139. .. rst-class:: classref-method
  140. :ref:`int<class_int>` **get_available_bytes**\ (\ ) |const| :ref:`🔗<class_StreamPeer_method_get_available_bytes>`
  141. Returns the number of bytes this **StreamPeer** has available.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_StreamPeer_method_get_data:
  145. .. rst-class:: classref-method
  146. :ref:`Array<class_Array>` **get_data**\ (\ bytes\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_get_data>`
  147. Returns a chunk data with the received bytes. The number of bytes to be received can be requested in the ``bytes`` argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an :ref:`Error<enum_@GlobalScope_Error>` code and a data array.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_StreamPeer_method_get_double:
  151. .. rst-class:: classref-method
  152. :ref:`float<class_float>` **get_double**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_double>`
  153. Gets a double-precision float from the stream.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_StreamPeer_method_get_float:
  157. .. rst-class:: classref-method
  158. :ref:`float<class_float>` **get_float**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_float>`
  159. Gets a single-precision float from the stream.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_StreamPeer_method_get_half:
  163. .. rst-class:: classref-method
  164. :ref:`float<class_float>` **get_half**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_half>`
  165. Gets a half-precision float from the stream.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_StreamPeer_method_get_partial_data:
  169. .. rst-class:: classref-method
  170. :ref:`Array<class_Array>` **get_partial_data**\ (\ bytes\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_get_partial_data>`
  171. Returns a chunk data with the received bytes. The number of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an :ref:`Error<enum_@GlobalScope_Error>` code, and a data array.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_StreamPeer_method_get_string:
  175. .. rst-class:: classref-method
  176. :ref:`String<class_String>` **get_string**\ (\ bytes\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_StreamPeer_method_get_string>`
  177. Gets an ASCII string with byte-length ``bytes`` from the stream. If ``bytes`` is negative (default) the length will be read from the stream using the reverse process of :ref:`put_string<class_StreamPeer_method_put_string>`.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_StreamPeer_method_get_u8:
  181. .. rst-class:: classref-method
  182. :ref:`int<class_int>` **get_u8**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_u8>`
  183. Gets an unsigned byte from the stream.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_StreamPeer_method_get_u16:
  187. .. rst-class:: classref-method
  188. :ref:`int<class_int>` **get_u16**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_u16>`
  189. Gets an unsigned 16-bit value from the stream.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_StreamPeer_method_get_u32:
  193. .. rst-class:: classref-method
  194. :ref:`int<class_int>` **get_u32**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_u32>`
  195. Gets an unsigned 32-bit value from the stream.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_StreamPeer_method_get_u64:
  199. .. rst-class:: classref-method
  200. :ref:`int<class_int>` **get_u64**\ (\ ) :ref:`🔗<class_StreamPeer_method_get_u64>`
  201. Gets an unsigned 64-bit value from the stream.
  202. .. rst-class:: classref-item-separator
  203. ----
  204. .. _class_StreamPeer_method_get_utf8_string:
  205. .. rst-class:: classref-method
  206. :ref:`String<class_String>` **get_utf8_string**\ (\ bytes\: :ref:`int<class_int>` = -1\ ) :ref:`🔗<class_StreamPeer_method_get_utf8_string>`
  207. Gets a UTF-8 string with byte-length ``bytes`` from the stream (this decodes the string sent as UTF-8). If ``bytes`` is negative (default) the length will be read from the stream using the reverse process of :ref:`put_utf8_string<class_StreamPeer_method_put_utf8_string>`.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_StreamPeer_method_get_var:
  211. .. rst-class:: classref-method
  212. :ref:`Variant<class_Variant>` **get_var**\ (\ allow_objects\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_StreamPeer_method_get_var>`
  213. Gets a Variant from the stream. If ``allow_objects`` is ``true``, decoding objects is allowed.
  214. Internally, this uses the same decoding mechanism as the :ref:`@GlobalScope.bytes_to_var<class_@GlobalScope_method_bytes_to_var>` method.
  215. \ **Warning:** Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_StreamPeer_method_put_8:
  219. .. rst-class:: classref-method
  220. |void| **put_8**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_8>`
  221. Puts a signed byte into the stream.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_StreamPeer_method_put_16:
  225. .. rst-class:: classref-method
  226. |void| **put_16**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_16>`
  227. Puts a signed 16-bit value into the stream.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_StreamPeer_method_put_32:
  231. .. rst-class:: classref-method
  232. |void| **put_32**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_32>`
  233. Puts a signed 32-bit value into the stream.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_StreamPeer_method_put_64:
  237. .. rst-class:: classref-method
  238. |void| **put_64**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_64>`
  239. Puts a signed 64-bit value into the stream.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_StreamPeer_method_put_data:
  243. .. rst-class:: classref-method
  244. :ref:`Error<enum_@GlobalScope_Error>` **put_data**\ (\ data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_StreamPeer_method_put_data>`
  245. Sends a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an :ref:`Error<enum_@GlobalScope_Error>` code.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_StreamPeer_method_put_double:
  249. .. rst-class:: classref-method
  250. |void| **put_double**\ (\ value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_StreamPeer_method_put_double>`
  251. Puts a double-precision float into the stream.
  252. .. rst-class:: classref-item-separator
  253. ----
  254. .. _class_StreamPeer_method_put_float:
  255. .. rst-class:: classref-method
  256. |void| **put_float**\ (\ value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_StreamPeer_method_put_float>`
  257. Puts a single-precision float into the stream.
  258. .. rst-class:: classref-item-separator
  259. ----
  260. .. _class_StreamPeer_method_put_half:
  261. .. rst-class:: classref-method
  262. |void| **put_half**\ (\ value\: :ref:`float<class_float>`\ ) :ref:`🔗<class_StreamPeer_method_put_half>`
  263. Puts a half-precision float into the stream.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_StreamPeer_method_put_partial_data:
  267. .. rst-class:: classref-method
  268. :ref:`Array<class_Array>` **put_partial_data**\ (\ data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) :ref:`🔗<class_StreamPeer_method_put_partial_data>`
  269. Sends a chunk of data through the connection. If all the data could not be sent at once, only part of it will. This function returns two values, an :ref:`Error<enum_@GlobalScope_Error>` code and an integer, describing how much data was actually sent.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_StreamPeer_method_put_string:
  273. .. rst-class:: classref-method
  274. |void| **put_string**\ (\ value\: :ref:`String<class_String>`\ ) :ref:`🔗<class_StreamPeer_method_put_string>`
  275. Puts a zero-terminated ASCII string into the stream prepended by a 32-bit unsigned integer representing its size.
  276. \ **Note:** To put an ASCII string without prepending its size, you can use :ref:`put_data<class_StreamPeer_method_put_data>`:
  277. .. tabs::
  278. .. code-tab:: gdscript
  279. put_data("Hello world".to_ascii_buffer())
  280. .. code-tab:: csharp
  281. PutData("Hello World".ToAsciiBuffer());
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_StreamPeer_method_put_u8:
  285. .. rst-class:: classref-method
  286. |void| **put_u8**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_u8>`
  287. Puts an unsigned byte into the stream.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_StreamPeer_method_put_u16:
  291. .. rst-class:: classref-method
  292. |void| **put_u16**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_u16>`
  293. Puts an unsigned 16-bit value into the stream.
  294. .. rst-class:: classref-item-separator
  295. ----
  296. .. _class_StreamPeer_method_put_u32:
  297. .. rst-class:: classref-method
  298. |void| **put_u32**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_u32>`
  299. Puts an unsigned 32-bit value into the stream.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_StreamPeer_method_put_u64:
  303. .. rst-class:: classref-method
  304. |void| **put_u64**\ (\ value\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StreamPeer_method_put_u64>`
  305. Puts an unsigned 64-bit value into the stream.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_StreamPeer_method_put_utf8_string:
  309. .. rst-class:: classref-method
  310. |void| **put_utf8_string**\ (\ value\: :ref:`String<class_String>`\ ) :ref:`🔗<class_StreamPeer_method_put_utf8_string>`
  311. Puts a zero-terminated UTF-8 string into the stream prepended by a 32 bits unsigned integer representing its size.
  312. \ **Note:** To put a UTF-8 string without prepending its size, you can use :ref:`put_data<class_StreamPeer_method_put_data>`:
  313. .. tabs::
  314. .. code-tab:: gdscript
  315. put_data("Hello world".to_utf8_buffer())
  316. .. code-tab:: csharp
  317. PutData("Hello World".ToUtf8Buffer());
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_StreamPeer_method_put_var:
  321. .. rst-class:: classref-method
  322. |void| **put_var**\ (\ value\: :ref:`Variant<class_Variant>`, full_objects\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_StreamPeer_method_put_var>`
  323. Puts a Variant into the stream. If ``full_objects`` is ``true`` encoding objects is allowed (and can potentially include code).
  324. Internally, this uses the same encoding mechanism as the :ref:`@GlobalScope.var_to_bytes<class_@GlobalScope_method_var_to_bytes>` method.
  325. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  326. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  327. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  328. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  329. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  330. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  331. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  332. .. |void| replace:: :abbr:`void (No return value.)`