format
typescript
FileStream.ReadBytes(stream, count)class: FileStream
description
Reads the specified number of bytes from the current stream and stores them in the target memory stream.
parameter
| param_name | type | description |
|---|---|---|
| stream | MemoryStream | The target memory stream. |
| count | number? | The number of bytes to read. |
reture
| type | description |
|---|---|
void |
code example
javascript
function Test(path: string) {
try {
let fileWrite = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
let msw = new MemoryStream();
msw.SetString("test111111");
msw.SetString("test222222");
fileWrite.WriteBytes(msw);
fileWrite.Close();
let fileRead = new FileStream(path, FileMode.Open, FileAccess.Read);
let msr = new MemoryStream();
fileRead.ReadBytes(msr);
Debug.Log(msr.GetString());
Debug.Log(msr.GetString());
fileRead.Close();
} catch (error) {
Debug.Error(error);
}
}