<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! 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> </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 <leves@elte.hu><br> <b><span style="font-weight: bold;">To:</span></b> Benoit St-Jean <bstjean@yahoo.com>; The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org> <br><b><span style="font-weight: bold;">Cc:</span></b> Squeak List <squeaklist@yahoo.com> <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>> You could have gone the other way around! Like this:<br>> <br>> | fs |<br>> fs := FileStream fileNamed: '1-2729.rtf'.<br>> oc do: [:each | fs nextPutAll: each asString].<br>> fs
close.<br>> <br>> <br>> 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>> <br>> <br>> <br>> -----------------<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)<br>> <br>>
__________________________________________________________________________________________________________________________________________________<br>> From: Squeak List <<a ymailto="mailto:squeaklist@yahoo.com" href="mailto:squeaklist@yahoo.com">squeaklist@yahoo.com</a>><br>> To: The general-purpose Squeak developers list <<a ymailto="mailto:squeak-dev@lists.squeakfoundation.org" href="mailto:squeak-dev@lists.squeakfoundation.org">squeak-dev@lists.squeakfoundation.org</a>><br>> Sent: Saturday, August 31, 2013 4:49:02 AM<br>> Subject: [squeak-dev] FileStream size limitation?<br>> <br>> Hello,<br>> <br>> I have an OrderedCollection with 24,576 elements.<br>> <br>> A bunch of musical notes basically: each of the 24,576 elements is like:<br>> #('eo6' 0.25 500)<br>> for example.<br>> <br>> Goal: I would like to turn that *entire* OrderedCollection into a single MIDI file.<br>> <br>> However, there
seems to be some sort of size limitation that I do not see how to get around.<br>> <br>> 1) Even before getting to the MIDI part, I tried:<br>> <br>> FileStream fileNamed: '1-24576.rtf'<br>> do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:24576) asString)].<br>> <br>> which creates a nice file of 48.8KB size.<br>> And opening the file, it ends with:<br>><br>> #('c#o6' 0.25 500) #('d...etc...<br>> which is not what I expected.<br>> <br>> 2) If I do:<br>> <br>> FileStream fileNamed: '1-2729.rtf'<br>> do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:2729) asString)].<br>> <br>> it works fine: ending tidily with the expected:<br>> <br>> #('c#o6' 0.25 500))<br>> <br>> 3) But,<br>> <br>> FileStream fileNamed: '1-2730.rtf'<br>> do: [:stream | stream nextPutAll: ((oc copyFrom: 1 to:2730) asString)].<br>> <br>> is where this starts:<br>><br>> #('c#o6'
0.25 500) #('d...etc...<br>> <br>> This exact same problem happens when making MIDI files: there seems to be a size limitation around 48.8KB.<br>> <br>> 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>> around this restriction?<br>> <br>> Any suggestions are most welcome.<br>> <br>> Thanks,<br>> ken<br>> <br>> Windows 7 - 64 bit<br>> <br>> Squeak4.4<br>> latest update: #12319<br>> Current Change Set: Unnamed<br>> Image format 6505 (32 bit)<br>> <br>> Squeak.exe<br>> Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331]<br>> Win32 built on Aug 22 2013 10:20:54 Compiler: 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)<br>> platform sources revision VM: r2776<br>> <br>> <br>> <br>> <br>> <br>> <br>><br><br></div> </div> </div> </div></body></html>