[Cuis-dev] Encoding a Form in a method

Hilaire Fernandes hfern at free.fr
Fri Aug 2 11:08:56 PDT 2024


For the record, here is what I did. Instead of the Form I have the 
original picture format encoded in the method (JPG, PNG whatever), it 
will be smaller.

  * Read the picture contents as binaryContents

I execute with Ctrl-I : '/home/hilaire/myPicture.jpg' asFileEntry 
binaryContents

  * An insepctor on a BinaryArray  with the full content is open. It
    looks like [153 234 ...]. I copy the array in a method returning it:

pictureData

     ^ [153 234 ...]

  * Another method will return the Form instance based on this picture data:

samplePicture

     ^ Form fromBinaryStream: self pictureData readStream


Hilaire

Le 02/08/2024 à 16:27, Hilaire Fernandes a écrit :
> Hi folks,
>
> What is the best practice to encode a Form within a method in a 
> package file .pck.st ?
>
> I found I can write:
>
> String streamContents: [:str | form storeOn: str]
>
> but the size is multiplied by 10.
>
> What are other options?
>
> Thanks
>
> Hilaire
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240802/9d40aece/attachment.htm>


More information about the Cuis-dev mailing list