VB example VC++ example Delphi example
The Encode method encodes data entirely in memory. It can encode data in a single call, or it can be called multiple times to encode data in a streaming fashion.
Parameter | Description |
---|---|
vaSource |
The data to encode. All OLE automation variant types are supported, including string and byte array variants. |
bEndOfData | This parameter indicates to the library whether or not there is more data to encode. If you only have a single block of data to encode, set this parameter to True. The library will then immediately encode all the data provided in the vaSource parameter and return the resulting encoded data. If you can only provide a portion of the data to encode in the vaSource parameter and will provide more data later in a subsequent call to the Encode method, set this parameter to False. In this case, the library will encode and return as much data as possible. When the final portion of the data to encode has been provided, set the bEndOfData parameter to True. The method will then return the final portion of the encoded data. |
The return value is a byte array variant containing the encoded data.
The EncodingFormat property allows you to specify the format of the encoded data to produce.
ToString and FromString
When calling the Encode method with the bEndOfData parameter specified as False, you cannot call any other Xceed Binary Encoding control method (of the same instance of the control) until you have completed processing a stream of data by calling the Encode method with the bEndOfData parameter specified as True.
With Visual Basic, it is often necessary to convert the resulting encoded data from a byte array variant to a native VB byte array before saving it or transmitting it. VB6 makes it particularly easy to do the conversion: If you have a variant named (for example) EncodedData, you can convert it to a native VB byte array with the following code:
Visual Basic | Copy Code |
---|---|
|
With Microsoft Access, you can place the encoded data in either a Memo field or an OLE Object field. Using an OLE Object field in a table is the easiest: You can directly assign your data to the field and conversion is automatic. To assign the encoded data variant to a Memo field, use the "AppendChunk" function in Access.
Declaration (DXceedBinaryEncoding) | Copy Code |
---|---|
HRESULT Encode |
Declaration (IXceedBinaryEncoding) | Copy Code |
---|---|
|