Files
playbook/skills/tsl-api-reference/references/codegen/builtin/object/tstream.md
T

122 lines
2.5 KiB
Markdown

# Object - TStream 流基类
## `TStream`
声明:class
定义顺序读写、定位和复制操作的流基类
<!-- tags: Object TStream 流基类 对象 实例 -->
### `copyFrom(src, count)`
声明:function
复制流,复制成功后当前位置会移动Count个位置
<!-- tags: Object TStream 流基类 对象 实例 -->
可见性:public
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `src` | TStream | 流类型,复制的来源 |
| `count` | integer | 整数类型,复制的个数 |
返回:integer
### `read(buffer, count)`
声明:function
读取内容
<!-- tags: Object TStream 流基类 读取 获取 对象 实例 -->
可见性:public
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `buffer` | integer | 任意类型,读取存贮到的缓冲区 |
| `count` | integer | 整数类型,读取的字节数,和Buffer的类型有关,如整数最多只可以四个字节 |
返回:integer
### `seek(position, origin)`
声明:function
移动指针
<!-- tags: Object TStream 流基类 对象 实例 -->
可见性:public
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `position` | integer | 整数,移动的位置 |
| `origin` | integer | 可选。整数类型,移动的方法。0:从头开始移,1:从当前位置,2:从尾部。省略参数的默认值为从头开始移 |
返回:integer
### `setSize(size)`
声明:function
设置大小。私有方法,实例与继承类无法访问。改变大小可通过属性Size进行赋值设置
<!-- tags: Object TStream 流基类 设置 修改 对象 实例 -->
可见性:public
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `size` | integer | 整数类型。要设置的新的大小 |
返回:any
### `write(buffer, count)`
声明:function
写入内容
<!-- tags: Object TStream 流基类 写入 保存 对象 实例 -->
可见性:public
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `buffer` | integer | 任意类型,写入的缓冲区 |
| `count` | integer | 整数类型,写入的字节数,和Buffer的类型有关,如整数最多只可以四个字节 |
返回:integer
### `Position`
声明:property
读写类型。设置或者得到当前的位置
<!-- tags: Object TStream 流基类 对象 实例 -->
可见性:public
类型:integer
访问:read/write
### `Size`
声明:property
读写类型。设置或者得到大小
<!-- tags: Object TStream 流基类 对象 实例 -->
可见性:public
类型:integer
访问:read/write