using UnityEngine;
using System.Collections;
using System;
using System.IO;
public class Test : MonoBehaviour {
void Start () {
TextAsset binData=Resources.Load<TextAsset> ("wp");//Resources文件夹下的wp.bytes, 后缀名必须为.bytes.读取swf文件,需改后缀名
byte[] bytes = binData.bytes;
readBytes (bytes);
}
private void readBytes(byte[] bytes){
MemoryStream memStream = new MemoryStream (bytes);
BinaryReader br = new BinaryReader (memStream);
Debug.Log ("Position:"+memStream.Position);// 0
Debug.Log(br.ReadByte ());//0x43==67 c
Debug.Log(br.ReadByte ());//0x57==87 w
Debug.Log(br.ReadByte ());//0x53==83 s
Debug.Log ("Position:"+memStream.Position);// 3
Debug.Log (0x43+","+ 0x57+","+ 0x53);
}
}