I'm sure I'm overlooking something very simple here so feel free to poke fun and laugh at me when responding but it seems as if the readAhead property on FileStream is being ignored for me. Based on the documentation the readAhead "property specifies how much data an asynchronous stream attempts to read beyond the current position." My assumption (I know this is where I'm doomed) was that the readAhead property acts as a throttle for the file async reading activities, so if you set the readAhead to 100 bytes it'll read 100 bytes, dispatch a ProgressEvent, assuming you grab those 100 bytes from the read buffer by executing one of the read functions in the progress event handler the filestream will grab the next 100 bytes. I'm not experiencing this so I'm guessing my assumptions are incorrect.
I'm performing an async read on a 2K file (test) and set the readAhead to a smaller value (828). I receive a single progress event which indicates that the bytesLoaded is the entire 2K, so that kills one of my assumptions. I read the same byte size I indicated in the readAhead property (after verifying the bytes are available with bytesAvailable). That's it...no complete event, no close event, no more progress events. There is still bytes contained in the read buffer. If readAhead doesn't keep the FileStream from loading larger chunks what's the point of the property?
I know I'm missing something here. Based on other "discussions" on this forum regarding the processing of large files it's suggested to set the readAhead property so the entire file isn't loaded into memory so it must work.
I'm going to write a little app that ONLY reads in a file to isolate the code. I'm using FlexBuilder 3 (build 3.0.214193) if it matters. I guess I'm just hoping for comfirmation that the readAhead property actually does what I think it does based on somebody having used it as such.
Thanks in advance.