On 9/23/07, <b class="gmail_sendername">Maciej Stachowiak</b> <<a href="mailto:mjs@apple.com">mjs@apple.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Obviously, if the way to get the contents as text requires providing<br>the encoding, then it has to be a method. My comment was about the no-<br>argument methods. But you have a point that reading from disk is not a<br>simple get operation. Probably the methods should have names based on
<br>read or the like (read(), readAsText(), etc) to indicate this. Also,<br>they should arguably be asynchronous since reading from the disk can<br>be slow, especially for large files, and it is undesirable to block<br>the main thread.
</blockquote><div><br>For small files, synchronous reading is OK. Perhaps there should be a separate whiz-bang asynchronous API ... it could support partial reads too.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also, I'm not sure how a web app can be expected to know the encoding<br>of a text file on disk.</blockquote><div><br>The same way that any other app does --- guess based on the extension and expected usage? --- now that we've all standardized on meta-data-less file systems :-(. I suppose an app could examine the first chunk of the file and then re-read the file with a better guess.
<br><br></div></div>Rob<br>-- <br>"Two men owed money to a certain moneylender. One owed him five hundred denarii, and the other fifty. Neither of them had the money to pay him back, so he canceled the debts of both. Now which of them will love him more?" Simon replied, "I suppose the one who had the bigger debt canceled." "You have judged correctly," Jesus said. [Luke 7:41-43]