StreamPeerBuffer
继承: StreamPeer
< RefCounted
< Object
A stream peer used to handle binary data streams.
描述
A data buffer stream peer that uses a byte array as the stream. This object can be used to handle binary data from network sessions. To handle binary data stored in files, FileAccess
can be used directly.
A StreamPeerBuffer object keeps an internal cursor which is the offset in bytes to the start of the buffer. Get and put operations are performed at the cursor position and will move the cursor accordingly.
属性
方法
void | clear ( ) |
StreamPeerBuffer | duplicate ( ) const1 |
int | get_position ( ) const1 |
int | get_size ( ) const1 |
void | resize ( size: int ) |
void | seek ( position: int ) |
属性说明
PackedByteArray
data_array = PackedByteArray()
void
set_data_array ( value:PackedByteArray
)PackedByteArray
get_data_array ( )
The underlying data buffer. Setting this value resets the cursor.
Note: The returned array is copied and any changes to it will not update the original property value. See PackedByteArray
for more details.
方法说明
void
clear ( )
Clears the data_array
and resets the cursor.
StreamPeerBuffer
duplicate ( ) const1
Returns a new StreamPeerBuffer with the same data_array
content.
Returns the current cursor position.
Returns the size of data_array
.
void
resize ( size: int
)
Resizes the data_array
. This doesn't update the cursor.
void
seek ( position: int
)
Moves the cursor to the specified position. position
must be a valid index of data_array
.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。