readint16 limit ???


    Mar 18 2006 | 10:54 pm
    Hi,
    i'm quite new to Javascript, so please forgive etc..
    can't figure this one out:
    I have this line to read a chunk from a file:
    var blockVals = curFile.readint16(totPoints*4);
    I know the file exists, it's open, it is long enough, but the above line gives me a 'BlockVals has no properties' error.
    the funny thing is that if I replace with this:
    var blockVals = curFile.readint16(totPoints); var blockVals = curFile.readint16(totPoints); var blockVals = curFile.readint16(totPoints); var blockVals = curFile.readint16(totPoints);
    there's no problem, it reads everything it has to read, but in four chunks. I'm trying this with a chunk of 9528 bytes (4764 int16's).
    so is this some limit to what readint16 can take ? (seems unlikely ??) or is this some limit to the length of implicitly declared arrays ?
    please enlighten...someone..thanks..
    ciao,
    Joost.
    -------------------------------------------
    Joost Rekveld ----------- http://www.lumen.nu/rekveld
    -------------------------------------------
    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim." (E. W. Dijkstra)
    -------------------------------------------

    • Mar 19 2006 | 9:06 pm
      Hi folks,
      i'm still a bit stuck here. This behaviours occurs with all kinds of files I've found out in the meantime, and there seems to be a limit of 8k to what readint16 can handle, below that all is fine...
      Where does this limit come from ? Is this a bug or some kind of buffer with a size I can set ? Is there another approach I should be taking to read larger chunks of files ?
      I hope somebody can explain, since I understand the 'file'-object is not a standard part of javascript..
      thanks,
      Joost.
      -------------------------------------------
      Joost Rekveld ----------- http://www.lumen.nu/rekveld
      -------------------------------------------
      "The mystery of the world is the visible, not the invisible" (Oscar Wilde)
      -------------------------------------------
    • Mar 19 2006 | 11:50 pm
      On Mar 19, 2006, at 1:06 PM, Joost Rekveld wrote:
      > i'm still a bit stuck here. This behaviours occurs with all kinds > of files I've found out in the meantime, and there seems to be a > limit of 8k to what readint16 can handle, below that all is fine... > > Where does this limit come from ? Is this a bug or some kind of > buffer with a size I can set ?
      The atom to JS conversion is limited to something like 4096 elements. This is not settable.
      > Is there another approach I should be taking to read larger chunks > of files ?
      Yes. Read in smaller chunks appending the corresponding array values as you read them in.
      -Joshua
    • Mar 20 2006 | 8:48 am
      thanks for the clarification Joshua, i'll do smaller chunks, since now I know why..
      thanks,
      Joost.
      -------------------------------------------
      Joost Rekveld ----------- http://www.lumen.nu/rekveld
      -------------------------------------------
      "The mystery of the world is the visible, not the invisible" (Oscar Wilde)
      -------------------------------------------