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.
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.
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 G. 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.
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 ?
Look-up Array#pack in your favorite documentation source.
James Edward G. 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 G. II
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.