format
typescript
FileStream.WriteBytes(stream)class: FileStream
description
Writes the byte data of the specified memory stream to the current stream.
parameter
| param_name | type | description |
|---|---|---|
| stream | MemoryStream | The specified memory stream. |
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);
}
}