File Encoding | ||
A common requirement for applications which use Internet protocols is the need to encode binary files, as well as compress data to reduce the bandwidth and time required to send or receive the data. Encoding a binary file converts the contents of the file into printable characters which can be safely transferred over the Internet using protocols that only support a subset of 7-bit ASCII characters. This is commonly a restriction for email, since many mail servers still are not capable of correctly processing messages which contain control characters, 8-bit data or multi-byte character sequences found in International text. To address this problem, the sender encodes and sends the data as part of a message; the recipient then extracts and decodes the data, with the end result being the same as the original, without any potential corruption by the mail servers which store and/or forward the message. The File Encoding control supports several encoding and decoding methods, including standard base64 encoding, quoted-printable encoding and uuencoding. For applications which access USENET newsgroup, the control also supports the yEnc encoding method, which has become popular for attaching binary files to a message. In addition to encoding and decoding files, the File Encoding control also can be used to compress files, reducing their overall size. Two compression algorithms are supported, the standard deflate algorithm which is commonly used in Zip files, and an algorithm based on the Burrows-Wheeler Transform (BWT) which can offer improved compression over the deflate algorithm for some types of files. The developer has control over the type of compression performed, as well as details such as the level of compression which determines how much memory and CPU time is allocated to compress the data. Unlike the other SocketTools controls, there are no handles used. All operations are performed either on files or on memory buffers provided by the application. The control is split into two general areas of functionality. The first group of methods enables you to encode and decode binary files and the second group enables you to compress and expand data. Note that if you are interested in using this control for purposes of attaching files to an email message, it is not necessary that you use these methods. The Mail Message control has the ability to automatically encode and decode file attachments without requiring that you use the methods in this control. However, the File Encoding control is useful if you need the ability to encode and/or compress for other applications. Encoding TypesThere are several different encoding types available, with the default being the standard MIME encoding called Base64. The following encoding methods are supported by the control:
Data EncodingEncoding a binary file converts the contents of the file into printable characters which can be safely transferred over the Internet using protocols that only support a subset of 7-bit ASCII characters. This is commonly a restriction for email, since many mail servers still are not capable of correctly processing messages which contain control characters, 8-bit data or multi-byte character sequences found in International text. To address this problem, the sender encodes and sends the data as part of a message; the recipient then extracts and decodes the data, with the end result being the same as the original, without any potential corruption by the mail servers which store and/or forward the message.
Data CompressionIn addition to encoding and decoding data, the control can be used to compress data in order to reduce its size. The compression methods may be used separately, or may be used as part of the process of encoding a file.
Note that there are advanced options for compressing files, such as the ability to specify the compression type and level. Please refer to the Technical Reference for more information. |
||
Copyright © 2024 Catalyst Development Corporation. All rights reserved. |