[Pharo-project] Best way for embed a file on Smalltalk image method

Igor Stasenko siguctua at gmail.com
Tue Oct 19 15:57:35 EDT 2010


data
 " #[ 1 2 3 4 5 6 .... ] "
 ^
Compiler evaluate: (((self class sourceCodeAt: #data) asString
findTokens: $") at: 2).



On 19 October 2010 21:40, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
> I would really like to know why this is so big.
>
> Stef
>
> On Oct 19, 2010, at 1:06 PM, nullPointer wrote:
>
>>
>> Hi
>>
>> I´m doing a class for embed files in class methods. I want know if exists a
>> best way for do that task than I´m using... I do something like that...
>>
>>
>>          codeSource := CLStringBuilder new.
>>               codeSource appendLine: nameOfResource; tab;
>>                                       appendFormat: '^''{1}'' -> ''' withValues: {fileName}.
>>
>>               readStream := FileStream readOnlyFileNamed: aFilePath.
>>
>>               base64Contents := (Base64MimeConverter mimeEncode: readStream binary)
>> contents.
>>
>>               codeSource append: base64Contents asString.
>>               codeSource append:''''.
>>
>>               CLSystem createMessageInClass: self
>>                       withCodeSource: (codeSource asString)
>>                       inProtocol: 'resources'
>>                       inClassSide: true.
>>
>>
>> I get the next result:
>>
>> courierNewBoldttf
>>
>>       ^'Courier New Bold.ttf' ->
>> 'AAEAAAATAQAABAAwRFNJR0rTjTkACiUQAAAbgEdERUYTqQ1VAApAkAAAAkxHUE9T3wr9iAAK
>> QtwAADeeR1NVQgwWqYIACnp8AAAT1k9TLzIQrF1xAAABuAAAAGBWRE1YNVhPeQAAGrwAABGU
>> Y21hcHepKTsAACxQAAAhqmN2dCCka4hDAABqbAAACA5mcGdtUXaa9wAATfwAAAdZZ2FzcAAW
>> AAkACiUAAAAAEGdseWbVwXRoAACjvAAI9Z5oZWFk05ZxuQAAATwAAAA2aGhlYQrAAZoAAAF0
>> .......... '.
>>
>>
>> Exists a enhanced way for do that? My main problem is the image grow very
>> much. When I export to Monticello I get a file of 900 KB. When embed a file
>> of 600KB the final size on Monticello file is 2MB!! and almost 4MB of
>> difference in size of image  :(
>>
>> Many thanks for the help
>>
>>
>>
>> --
>> View this message in context: http://forum.world.st/Best-way-for-embed-a-file-on-Smalltalk-image-method-tp3001915p3001915.html
>> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list