[Pharo-users] What is your preferred way for storing ByteArray's as text?
Sven Van Caekenberghe
sven at stfx.eu
Thu Oct 29 13:21:44 EDT 2015
> On 29 Oct 2015, at 17:02, Esteban A. Maringolo <emaringolo at gmail.com> wrote:
> 2015-10-29 12:44 GMT-03:00 Sven Van Caekenberghe <sven at stfx.eu>:
>>> On 29 Oct 2015, at 16:35, Esteban A. Maringolo <emaringolo at gmail.com> wrote:
>>> Hello all,
>>> As some already know I'm working in the new GLORP port from VW to Pharo.
>>> And as part of minor modifications I'm making to the code, I'd like to know what is your preferred way of storing ByteArrays as text representation/CLOB, etc...
>>> Option A) The printString of ByteArray, it is #[23 12 253 ...]
>>> Option B) A Base64 encoded version of the ByteArray
>>> Option C) Some other encoding
>> Does that not dependent, at least in part, on the actual underlying SQL DB ?
> Yes it does, but certain backends (like SQLite) doesn't provide BLOB
> storage, and that's why I'm talking about CLOB (character instead of
> byte based) or text representations for it. I'd like to have a lowest
> common denominator to use as a fallback.
>> I think HEX and Base64 are make the most sense.
> Is Base64 more compact than Hex? (I guess it is, given it's 64vs16 :D)
(0 to: 255) asByteArray base64Encoded size. "348"
(0 to: 255) asByteArray hex size. "512"
Beware the newlines in Base64 (better disable them)
> Esteban A. Maringolo
More information about the Pharo-users