How do I use fileStream without reading the file into memory?
I am writing a process where users will need to select a file that far exceeds their availble RAM and have that file broken up into small chunks (for upload).
I'm able to create a File reference to said file, but when I try to pass it to the fileStream, it appears to try to read the thing into memory before acting on it.
Is there a way to get fileStream to just take the reference to the file and then utilize readBytes the way it's documented?
Much obliged, in advance.
Here is my code... just in case I'm doing something blatantly stupid...
//this is being called by the File callback, uplon the user browsing over to the selected file.
private function selectHandler(event:Event):void {
var file:File = File(event.target);
trace("selectHandler: name=" + file.name );
var stream:FileStream = new FileStream();
var f:File = event.target as File;
stream.open(f, FileMode.READ); //at this point, the program will lock up if the file exceeds the computer's memory buffer.
var bytes:ByteArray = new ByteArray();
stream.readBytes(bytes,0,1024);
trace(bytes);
stream.close();
}
-Dr.D
