VB example VC++ example Delphi example C# example VB.NET example
In the descriptions below, you can freely replace the word "encode" with "decode" in order to find out how to decode data, because encoding and decoding work exactly the same way.
To encode data entirely in memory, from one memory buffer to another in a single pass, perform the following 4 steps. Put the Xceed Binary Encoding control on a form or instantiate it, then:
Specify the format for the resulting encoded data. To do this, set the EncodingFormat property.
Tell the library to encode. To do this, call the Encode method, passing your source memory buffer and specifying True for the bEndOfData parameter.
Obtain the encoded data. To do this, assign the return value of the Encode method to the variable of your choice.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Binary Encoding Library supports standard COM error handling functionality.
To encode data entirely in memory while providing the library with data to encode as it becomes available, perform the following 5 steps. Put the Xceed Binary Encoding Control on a form or instantiate it, then:
Specify the format for the resulting encoded data. To do this, set the EncodingFormat property.
Provide each block of data to the library as it becomes available. To do this, call the Encode method for each portion of data, passing the memory buffer with a portion of the data and specifying False for the bEndOfData parameter.
Accumulate the encoded data. To do this, append the data returned by the Encode method to a variable which contains the complete encoded memory buffer so far. You can also process the encoded data as it is returned by the library or pass it to other streaming methods.
Continue providing blocks of data to encode until you're done. When there is no more data to encode, call the Encode method with a final (or empty) block of data to encode and specify True for the bEndOfData parameter. Be sure to assign the Encode method's final returned encoded data to your accumulation variable or process it or pass it to other streaming methods.
Make sure that everything worked properly. To do this, use your language's error handling object or error handling capabilities. The Xceed Binary Encoding Library supports standard COM error handling functionality.