James Gray
6/29/2007 2:57:00 PM
On Jun 29, 2007, at 9:50 AM, Googy wrote:
> On Jun 29, 5:55 pm, James Edward Gray II <j...@grayproductions.net>
> wrote:
>> On Jun 29, 2007, at 6:25 AM, Googy wrote:
>>
>>> I am porting a library from java to ruby. My problem is simulating
>>> ByteArrayOutputStream in ruby. I want to pack bytes integers and
>>> all
>>> other kinds of data in to a stream buffer then get it as a packed
>>> string and send it over network.
>>
>> Look-up Array#pack in your favorite documentation source.
>>
>> James Edward Gray II
>
> Yeah, Did that before.
> But My problem is I collect binary data as the program runs and then
> send it over the network. So I want to know if there are any classes
> proving in memory streams.
Well, String and Array can both be added too as needed, so I'm not
sure how they fail to meet your needs.
> I have one more doubt, how do you concatenate two packed values, for
> e.g you pack some stuff into a string at one location, and in some
> other location you pack another chunk of binary data. And how do you
> concatenate those two packed values, is normal string concatenation is
> sufficient for concatenating two chunks of binary data packed in
> strings ?
Sure.
James Edward Gray II