[Glass] How to properly write bytes objects into binary streams?
Mariano Martinez Peck via Glass
glass at lists.gemtalksystems.com
Wed Sep 3 11:58:57 PDT 2014
On Wed, Sep 3, 2014 at 3:48 PM, Dale Henrichs <
dale.henrichs at gemtalksystems.com> wrote:
> Take a look at Integer class>>_new:neg: ... the implication is that you
> might need to store "digits" instead of bytes ....
>
>
Thanks Dale. But that only works for Integers. I am looking for a
polimorphic way for all type of byte-objects that are not
SequenceableCollection subclasses. Float, Character, LargeInteger, Integer
etc. OK, I do have the polimorphic way to get all bytes and write it to the
binary stream using #_basicSize and #basicAt: . But then I am missing the
materialization part. Actually, I miss the instance creation method to
create an instance with a concrete size, so that I can then do the
#_basicAt:put:
Thanks,
> Dale
>
>
> On Wed, Sep 3, 2014 at 11:43 AM, Mariano Martinez Peck via Glass <
> glass at lists.gemtalksystems.com> wrote:
>
>>
>>
>>
>> On Wed, Sep 3, 2014 at 1:12 PM, Martin McClure <
>> martin.mcclure at gemtalksystems.com> wrote:
>>
>>> On 09/03/2014 06:58 AM, Mariano Martinez Peck wrote:
>>>
>>>>
>>>>
>>> [...]
>>>
>>>
>>>
>>>> But again, I want to go step by step.
>>>>
>>>> If the answer to either of these is "yes," then things get a bit
>>>> more complicated.
>>>>
>>>>
>>>> Even if they would be desired later, right now, I am fine with a "No"
>>>> answer.
>>>>
>>>>
>>> OK, for the limited gs-to-gs case, same endianness...
>>>
>>> Since in GemStone #replaceFrom:to:with: expects to be copying from a
>>> collection, not (for instance) a LargeInteger, the most generic way to copy
>>> the bytes of a byte object is probably to write a loop that uses
>>> #_basicSize and #_basicAt: to access the bytes.
>>>
>>
>> OK. Thanks. But then how can I create an empty instance of one of them,
>> in a general way, and with a certain size? I tried:
>>
>> LargeInteger _basicNew: 10
>>
>> But it fails.
>>
>> Thanks,
>>
>>
>>
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>> _______________________________________________
>> Glass mailing list
>> Glass at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>
>>
>
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140903/d436b514/attachment-0001.html>
More information about the Glass
mailing list