Picture as String

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Picture as String

che-8
Thanks Janko,

but what really helps is this.

Make this Methode under class String.

contentsAsMethod: path
     "return a body of method with a literal array with contents
      of that string"

     | input output |
     input := FileStream read: path text: false.
     output := WriteStream with: String new.
     output nextPutAll: '^#['.
     [input atEnd] whileFalse:
             [output
                 nextPutAll: input next asInteger asString;
                 nextPut: $ ].
     output nextPutAll: ']'.
     ^output contents


Then let it display in your workspace:

String new contentsAsMethod: 'c:\123\picture.jpg'



_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Picture as String

Nicolas Petton
Hi,

Why don't you just use SpFilename>>contentsAsMethod?

Le vendredi 13 février 2009 à 11:26 +0100, che a écrit :

> Thanks Janko,
>
> but what really helps is this.
>
> Make this Methode under class String.
>
> contentsAsMethod: path
>      "return a body of method with a literal array with contents
>       of that string"
>
>      | input output |
>      input := FileStream read: path text: false.
>      output := WriteStream with: String new.
>      output nextPutAll: '^#['.
>      [input atEnd] whileFalse:
>              [output
>                  nextPutAll: input next asInteger asString;
>                  nextPut: $ ].
>      output nextPutAll: ']'.
>      ^output contents
>
>
> Then let it display in your workspace:
>
> String new contentsAsMethod: 'c:\123\picture.jpg'
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (204 bytes) Download Attachment