Base 64 Binary

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Base 64 Binary

Postby gkipe » Fri Aug 07, 2009 1:50 pm

I am trying to pass a SOAP attachment in Base 64 Binary format. How would I open a file in this format?

Thanks,
Garet
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Base 64 Binary

Postby marten » Sat Aug 08, 2009 1:03 am

gkipe wrote:I am trying to pass a SOAP attachment in Base 64 Binary format. How would I open a file in this format?

Thanks,
Garet


It's a binary file, which content is converted to base64. This is done to make it possible to send binary data within eMails
or non-binary (7 bits) transport ways. Its just a way to represent a binary file in an ascii oriented way.

In VASmalltalk there are two classes, which can handle (convert to/from) this format: SstBase64Coder and AbtBase64Coder.

If you need conversions like this very often, you may also consider wrapping external c libraries doing this jobs very much faster than pure Smalltalk code. One way to do this is to use the Base64 AP called defined in Gnome (even under Windows).

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Base 64 Binary

Postby wembley » Sat Aug 08, 2009 1:47 am

marten wrote:In VASmalltalk there are two classes, which can handle (convert to/from) this format: SstBase64Coder and AbtBase64Coder.


You should use AbtBase64Coder since it is the replacement for SstBase64Coder (which is depricated).
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Base 64 Binary

Postby gkipe » Mon Aug 10, 2009 7:28 am

Is AbtBase64Coder supported by 5.5.2? ( managment decision, dont ask ). I'm not finding the class.
Thanks.
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Base 64 Binary

Postby wembley » Mon Aug 10, 2009 7:31 am

I don't believe it was in VAST 5.5.2. The code is the same in the 2 classes, we just promoted it from SST to the Base somewhere along the line.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: Base 64 Binary

Postby gkipe » Tue Aug 11, 2009 5:28 am

Marten,
I see that you posted on Feb. 12, 2007 about creating a VA Wrapper for base64 support, and that its fast and available for download. Can I get a link from you so I can play around with your wrapper. Thanks in advance. -Garet
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Base 64 Binary

Postby marten » Tue Aug 11, 2009 7:18 am

gkipe wrote:Marten,
I see that you posted on Feb. 12, 2007 about creating a VA Wrapper for base64 support, and that its fast and available for download. Can I get a link from you so I can play around with your wrapper. Thanks in advance. -Garet


I have uploaded it at http://vastgoodies.com/ - you also need glib (gnome), which contains the wrapped API calls.

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Base 64 Binary

Postby gkipe » Tue Aug 11, 2009 7:24 am

Too funny, I just got my call to g_base64_encode function in libglib-2.0-0.dll working. A little slow for files over 1MB, but workable.
Thanks, I'll go grab your goodies anyway and check it out. Thanks -Garet
gkipe
 
Posts: 24
Joined: Tue Feb 03, 2009 11:05 am

Re: Base 64 Binary

Postby marten » Tue Aug 11, 2009 12:19 pm

gkipe wrote:Too funny, I just got my call to g_base64_encode function in libglib-2.0-0.dll working. A little slow for files over 1MB, but workable.
Thanks, I'll go grab your goodies anyway and check it out. Thanks -Garet


"A little slow for files over 1MB" ? I was surprised about this statement. I have now wrapped the libb64 library mentioned at wikipedia - which the author claimed to be very fast - and encoded a (ByteArray-) stream with a size of about 25 MB:

* glib needs around 300 ms to do the work
* libb64 needs around 1200 ms to do the work (using Watcom 1.8)
* AbtBase64Coder needs around 12800 ms to do the work

Seems to be pretty good !?

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest