Xceed Binary Encoding Library Documentation
Decode method
Xceed Binary Encoding control reference > Methods > Decode method

Description

The Decode method decodes data entirely in memory. It can decode data in a single call, or it can be called multiple times to decode data in a streaming fashion.

Parameters
 

Parameter Description
vaEncoded  The data to decode. The variant can contain a string or a byte array.
bEndOfData  This parameter indicates to the library whether or not there is more data to decode.

If you only have a single block of data to decode, set this parameter to True. The library will then immediately decode all the data provided in the vaEncoded parameter and return the resulting decoded data.

If you can (or want to) only provide a portion of the data to decode in the vaEncoded parameter and will provide more data later in a subsequent call to the Decode method, set this parameter to False. In this case, the library will decode and return as much data as possible. When the final portion of the data to decode has been provided, set the bEndOfData parameter to True. The method will then return the final portion of the decoded data.

Return value

The return value is a byte array variant containing the decoded data.

Associated properties

Set the EncodingFormat property so that the library can determine the format of the encoded data.

Associated methods

ToString and FromString

Remarks

When calling the Decode 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 Decode method with the bEndOfData parameter specified as True.

Language-specific remarks

With Visual Basic, it is often necessary to convert the resulting decoded 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) DecodedData, you can convert it to a native VB byte array with the following code:

Visual Basic Copy Code

Dim DecodedDataArray() As Byte
DecodedDataArray = DecodedData

With Microsoft Access, you can place the decoded 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 decoded data variant to a Memo field, use the "AppendChunk" function in Access.

Declaration (DXceedBinaryEncoding) Copy Code
HRESULT Decode
(
  [in] VARIANT* vaEncoded,
  [in] VARIANT_BOOL bEndOfData,
  [out, retval] VARIANT* vaDecoded
)
Declaration (IXceedBinaryEncoding) Copy Code

HRESULT Decode
(
  [size_is][in] BYTE* pcEncoded,
  [in] DWORD dwEncodedSize,
  [in] BOOL bEndOfData,
  [size_is][size_is][out] BYTE** ppcDecoded,
  [out, retval] DWORD* pdwDecodedSize
)