Mabry Software's Encoder/X ActiveX control and
COM object provides an easy and powerful way to
handle the data encoding formats used by various
Internet protocols. The four basic encoding types
used by protocols such as mail and news are
Base64, BinHex 4.0, Quoted-Printable, and UU.
Encoder/X provides a number of functions to
convert back and forth between binary (or text)
data and any of these formats.
The Encoder/X control provides unlimited
flexibility when it comes to specifying source
and destination for the data being encoded or
decoded. The following methods fulfill basic
requirements: FileToString, FileToFile,
StringToFile, and StringToString. In addition,
Encoder/X utilizes our new Streams technology to
provide a fully extensible way of accessing and
storing encoded/decoded data.
Our Streams objects include the following:
MemStream, VirtualMemStream, and FileStream. Any
of these can be used by Encoder/X's
StreamToStream method. And there are
StreamToFile, StreamToString, FileToStream, and
StringToStream methods. If, for instance, you
have a file containing a huge amount of data, you
could create a VirtualMemStream and then use the
FileToStream method to decode the data. Using
this technique, you can easily access many tens
of megabytes of data.
Encoder/X also makes use of the IMStream
interface. The Encoder and Decoder objects
Implement the IMStream interface, and each of
them has an In property to which an IMStream
object can be assigned. This makes it easy to
perform a number of conversion jobs. For
instance, if you need to convert UU encoded data
stored in a file to Base64 in memory, you could
do that easily by following this procedure:
1. Create a FileStream for the source data to be
2. Assign the source stream to the Decoder's In
3. Set the Decoder's EncodingType property to
4. Assign the Decoder Out itself to the Encoder's
In property (this works because both Encoder and
Decoder Implement the IMStream interface).
5. Use the Encoder's IMStream interface's Read
method to read data from the Encoder.
To explain - when you call the Encoder's Read
method, it calls the Decoder's Read method to get
some data to encode. The Decoder decodes the data
and returns it to the Encoder that encodes the
data and returns it to your program.
Of course, there are a number of ways to
accomplish this same task using Encoder and
Decoder. You will be able to choose the way that
works best for you in any given situation.
And for those of you who have _really_ large
amounts of data to encode or decode, Encoder and
Decoder objects provide background processing on
a separate thread! If you set the Blocking
property to False and call one of the methods,
the method call will return immediately, and the
method itself will begin executing in the
background. As data is encoded or decoded,
Progress events fire so the programmer can
provide a visual indicator to the user. When the
method has finished, the Done event fires.
And, last but not least, Encoder/X comes in both
Active/X Control and COM Object versions. We
strongly recommend using the COM object wherever
possible. It's smaller, slightly faster, and
doesn't impact form load times.
Mabry Software's Encoder/X provides the most
versatile and powerful Encoder and Decoder
For historical reasons, there are e-mail systems
on the Internet that are not able to correctly
transmit and/or receive e-mail messages
containing 8-bit data. Instead, they can process
only 7-bit data.
Restricting data to 7 bits was fine when only
text messages were being transported. But now
we want to transmit everything - images,
pictures, sound, etc. Such items are transmitted
as attachments. Since these attachments require
that each byte's 8 bits are transmitted, it is
necessary to have a way to convert collections of
8-bit data into 7-bit data to accommodate the 7-
bit e-mail systems.
Note: in the context of e-mail programs,
encoding refers to the process of turning 8-bit
data into 7-bit data. Decoding refers to the
Types of Encoding
There are four types of encoding commonly used in
email messages: Base64, Bin Hex 4.0, UUencode,
and Quoted-Printable, all of which are supported
by the Mabry Encoder/Decoder objects and
Base64 is the preferred encoding format. Base64
works very well and has none of the problems
associated with the other formatting schemes.
Unless there is some unusual compelling
circumstance, you will want to use Base64 to
encode messages. But you must also give users of
your program the option to select other encoding
types. Some e-mail clients have limited
capabilities and demand UUencode or one of the
Bin Hex 4.0 is rarely used since it is really a
UUencode preceded Base64 and is very similar
except that it suffers from multiple almost-the-
same implementations - no doubt a result of its
origins in multiple almost-compatible UNIX
systems. But again, you must be prepared to
receive UUencoded email. UUencoding also suffers
from a deficiency in its encoding scheme in that
certain characters it uses may be modified as the
email passes through various systems - especially
those that convert ASCII to EBCDIC. For these
reasons, avoid UUencode whenever possible.
Quoted-Printable is not suitable for encoding
large amounts of data because it uses three 7-bit
characters to encode one 8-bit character (Base
64, Bin Hex 4.0, and UUencode use 7-bit
characters to encode every three 8-bit
characters). However, messages encoded with
Quoted-Printable are seen from time-to-time and
your program must be prepared to decode them.
What Are Streams?
Streams are used to store data. Three standard
stream types are provided by Mabry: MemStream,
FileStream, and VMemStream. Each type has
different characteristics in terms of speed,
memory usage, and easy persistence.
Any object that implements the IMStream Interface
has access to one of the five IMStream Interface
methods: Read, Write, Seek, Clone, and Copy.
See the IMStream Interface documentation for more
When Should I Use Streams?
The Mail/X Message and Part Objects both expose a
BodyStream property. When a new Message or Part
is created, the BodyStream property can be used
to access a MemStream Object.
If you have a file and you want to send its
encoded contents in a given message, you can use
the FileToStream method to encode the contents of
the file and place the result in the stream.
Later, when the message is transmitted, the
contents of the stream will be sent.
But what if you have one or more huge
attachments? Fifteen megabytes or more are often
seen now that high-bandwidth connections are
becoming the norm. The encoded data is going to
total 20 megabytes and, while it is possible to
use the default MemStream Object, it is hardly a
good idea. In such cases you can create either a
VMemStream, which uses virtual memory, or a
FileStream. Then you use the Encoder's
FileToStream method, as before, and assign the
stream to the Message's BodyStream property.
Because the encoded data is stored on the disk in
a temporary file, very little RAM is used - and
the programming model hasn't changedt, making it
easy to make on-the-fly choices regarding the
type of stream to use in a given situation.
The samples in this section are intended to
demonstrate only the basic uses of the Encoder
and Decoder objects. More complicated uses are
demonstrated in the sample programs included with
the Encoder/X package.
Encoding A File
This sample demonstrates how to encode a file and
place the encoded data into a FileStream object.
Note: your VB project must reference the
Encoder/Decoder and Stream objects in order to
implement this code.
Dim Encoder As New Encoder
Dim DstStream As New FileStream
On Error Resume Next
Encoder.FileToStream "c:\somefile.exe", DstStream
If (Error) Then
MsgBox "Encoder failed - " &
See what our customers have to say about
View Encoder/X's release notes.
ActiveX Control (32-bit OCX)
File Name ENCODEX.OCX
Compatibility VB 5.0 and 6.0, VC 5.0 and 6.0,
Access 95 and above, VFP 5.0 and 6.0
Built Using Microsoft Visual C++ v6
Download File Size:1002.21 KB