"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
Class: CUUEncode
Class that encodes and decodes files using UU Encoding. UU Encoding is an algorithm for converting binary data to 6-bit ASCII. This is often needed to send binary files through internet mail gateways. UU Encoding is also commonly used in internet newsgroups for posting binary data.
UU Encoding breaks a group of 3 eight bit characters (24 bits) into 4 six bit characters (also 24 bits) and then adds 32 (a space) to each six bit character. This maps it into a transmittable character set. These characters are:
!"#$%&'()*+,-./
0123456789:;=?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the CUUEncode class
|
|
InputFileName
|
Property
|
Gets the name of the input file
|
|
OutputFileName
|
Property
|
Sets the name of the output file
|
|
dblToLong
|
Private
|
Performs an unsigned conversion from a Double value to a Long value.
This function correctly handles doubles greater than 2,147,483,647 and less than or equal to 4,294,967,295.
|
|
Decode
|
Method
|
Decodes a file encoded with UUEncoding
|
|
DecodeByte
|
Private
|
Decodes a single byte.
|
|
Encode
|
Method
|
Encodes a file using UU Encoding
|
|
EncodeByte
|
Private
|
Encodes a byte by manipulating the byte to ensure that it is a printable character code
|
|
GetNamePart
|
Private
|
Returns the name and extension of a fully qualified file name
|
|
GetPathPart
|
Private
|
Returns the path part of a string
|
|
IntToByte
|
Private
|
Performs an unsigned conversion from an integer value to a byte value. This procedure correctly handles any integer value.
For example, performing the following assignment
lngNumber = -1
assigns -1 to the variable lngNumber. However, This assignment
lngNumber = IntToLong(-1)
assigns 65,535 to lngNumber.
|
|
IntToLong
|
Private
|
Converts an integer value to a long value, treating the integer as unsigned
|
|
LongToInt
|
Private
|
Performs an unsigned conversion from a Long value to an integer value
|
|
MakeInt
|
Private
|
Combines two bytes into an integer.
|
|
MakeLong
|
Private
|
Combines two words (integers) into a long. This routine correctly handles negative input Values
|
|
MakePrintable
|
Private
|
Takes three bytes and converts them into 4 printable characters
|
|
ReadFile
|
Private
|
Reads the specified number of bytes from the file
Using this function significantly increases the speed of processing files. The alternative to using a file buffer is reading a byte at a time from the file
|
|
Shlb
|
Private
|
Shifts a numeric value left the specified number of bits.
Left shifting can be defined as a multiplication operation. For the number of bits we want to shift a value to the left, we need to raise two to that power, then multiply the result by our original value.
|
|
Shrb
|
Private
|
Shifts a byte value right the selected number of places.
Right shifting can be defined as a division operation. For the number of bits we want to shift a value to the right, we need to raise two to that power, then our original value by the result.
|
|
UnMakePrintable
|
Private
|
Take 4 printable characters and convert them into 3 bytes
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|