我读有限(小 - 15 - 500 MB文件).我需要能够将所有文件字节放入一个单独的bytearray中.所以我有一个功能:
[Bindable]
public var ba:ByteArray = new ByteArray;
//.... code ....//
protected function fileOpenSelected(event:Event):void
{
currentFile = event.target as File;
stream = new FileStream();
stream.openAsync(currentFile, FileMode.READ);
stream.readBytes(ba);
stream.close();
MyFunction(ba);
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用=( - 给我错误:错误#2030:遇到文件结束.
如何从流中获取完整的bytearray以将其用作普通的bytearray?