<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt">Well,<br><br>1) The #asString is not necessary since, from what I understood, the elements of the OrderedCollection are Strings already!&nbsp; Besides, if that is not the case, the items in that collection are limited to less than 20 character strings so there wouldn't be any truncation problem there!<br>2) Since it was a "one time" conversion (and not something called repeatedly (if I understood correctly), being somewhat slow ain't a major concern here.<br><div><span><br></span></div><div>&nbsp;</div><div>-----------------<br>Benoit St-Jean<br>Yahoo! Messenger: bstjean<br>Blogue: endormitoire.wordpress.com<br>A standpoint is an intellectual horizon of radius zero.<br>(Albert Einstein)</div><div><br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times,
 serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Levente Uzonyi &lt;leves@elte.hu&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Benoit St-Jean &lt;bstjean@yahoo.com&gt;; The general-purpose Squeak developers list &lt;squeak-dev@lists.squeakfoundation.org&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> Squeak List &lt;squeaklist@yahoo.com&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Sunday, September 1, 2013 8:39:41 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [squeak-dev] FileStream size limitation?<br> </font> </div> <div class="y_msg_container"><br>On Sat, 31 Aug 2013, Benoit St-Jean wrote:<br><br>&gt; You could have gone the other way around!&nbsp; Like this:<br>&gt; <br>&gt; | fs |<br>&gt; fs := FileStream fileNamed: '1-2729.rtf'.<br>&gt; oc do: [:each | fs nextPutAll: each asString].<br>&gt; fs
 close.<br>&gt; <br>&gt; <br>&gt; That way, regardless of the size of your collection, it will always work!<br><br>There are two reasons why this is not the best way to do it:<br>1) #asString might cause truncation, which was the original problem. If <br>one element's #printString (sent by #asString) were longer than 50000 <br>characters, then it would be truncated. The proper solution is to use <br>#printOn: (but see below why it's not the best idea either).<br>2) FileStreams are not write buffered. Each write (#nextPutAll:) will <br>call a primitive, which can be rather slow.<br><br><br>Levente<br><br>&gt; <br>&gt; <br>&gt; &nbsp;<br>&gt; -----------------<br>&gt; Benoit St-Jean<br>&gt; Yahoo! Messenger: bstjean<br>&gt; Blogue: endormitoire.wordpress.com<br>&gt; A standpoint is an intellectual horizon of radius zero.<br>&gt; (Albert Einstein)<br>&gt; <br>&gt;
 __________________________________________________________________________________________________________________________________________________<br>&gt; From: Squeak List &lt;<a ymailto="mailto:squeaklist@yahoo.com" href="mailto:squeaklist@yahoo.com">squeaklist@yahoo.com</a>&gt;<br>&gt; To: The general-purpose Squeak developers list &lt;<a ymailto="mailto:squeak-dev@lists.squeakfoundation.org" href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>&gt;<br>&gt; Sent: Saturday, August 31, 2013 4:49:02 AM<br>&gt; Subject: [squeak-dev] FileStream size limitation?<br>&gt; <br>&gt; Hello,<br>&gt; <br>&gt; I have an OrderedCollection with 24,576 elements.<br>&gt; <br>&gt; A bunch of musical notes basically: each of the 24,576 elements is like:<br>&gt; #('eo6' 0.25 500)<br>&gt; for example.<br>&gt; <br>&gt; Goal: I would like to turn that *entire* OrderedCollection into a single MIDI file.<br>&gt; <br>&gt; However, there
 seems to be some sort of size limitation that I do not see how to get around.<br>&gt; <br>&gt; 1) Even before getting to the MIDI part, I tried:<br>&gt; <br>&gt; FileStream fileNamed: '1-24576.rtf'<br>&gt; do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:24576) asString)].<br>&gt; <br>&gt; which creates a nice file of 48.8KB size.<br>&gt; And opening the file, it ends with:<br>&gt;<br>&gt;&nbsp; #('c#o6' 0.25 500) #('d...etc...<br>&gt; which is not what I expected.<br>&gt; <br>&gt; 2) If I do:<br>&gt; <br>&gt; FileStream fileNamed: '1-2729.rtf'<br>&gt; do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:2729) asString)].<br>&gt; <br>&gt; it works fine: ending tidily with the expected:<br>&gt; <br>&gt; #('c#o6' 0.25 500))<br>&gt; <br>&gt; 3) But,<br>&gt; <br>&gt; FileStream fileNamed: '1-2730.rtf'<br>&gt; do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:2730) asString)].<br>&gt; <br>&gt; is where this starts:<br>&gt;<br>&gt;&nbsp; #('c#o6'
 0.25 500) #('d...etc...<br>&gt; <br>&gt; This exact same problem happens when making MIDI files: there seems to be a size limitation around 48.8KB.<br>&gt; <br>&gt; Aside from MIDI, is FileStream just the wrong class to use for anything larger than creating a 48.8kb text file (.txt or .rtf)? Or how can I get<br>&gt; around this restriction?<br>&gt; <br>&gt; Any suggestions are most welcome.<br>&gt; <br>&gt; Thanks,<br>&gt; ken<br>&gt; <br>&gt; Windows 7 - 64 bit<br>&gt; <br>&gt; Squeak4.4<br>&gt; latest update: #12319<br>&gt; Current Change Set: Unnamed<br>&gt; Image format 6505 (32 bit)<br>&gt; <br>&gt; Squeak.exe<br>&gt; Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331]<br>&gt; Win32 built on Aug 22 2013 10:20:54 Compiler: 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)<br>&gt; platform sources revision VM: r2776<br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt;<br><br></div> </div> </div>  </div></body></html>