MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ReadString

Method ReadString

Source/Engine/Networking/NetworkStream.cs:253–263  ·  view source on GitHub ↗

Reads and returns data of type from the message. UTF-16 encoded.

()

Source from the content-addressed store, hash-verified

251 /// Reads and returns data of type <see cref="string"/> from the message. UTF-16 encoded.
252 /// </summary>
253 public string ReadString()
254 {
255 // Note: Make sure that this is consistent with the C++ message API!
256 var stringLength = ReadInt32();
257 if (stringLength == 0)
258 return string.Empty;
259 var dataLength = stringLength * sizeof(char);
260 var bytes = stackalloc char[stringLength];
261 ReadBytes((byte*)bytes, dataLength);
262 return new string(bytes, 0, stringLength);
263 }
264
265 /// <summary>
266 /// Writes data of type <see cref="Guid"/> into the message.

Callers

nothing calls this directly

Calls 2

ReadInt32Function · 0.85
ReadBytesFunction · 0.85

Tested by

no test coverage detected