|
|
COM Object PersistenceSome COM objects support persistence. Such objects can save their current state to memory or file, and then restore the saved state later.EZ JCom supports COM object persistence via two methods provided in the class ezjcom.JComObject. These methods are
The byte array returned by JComSaveObjectState may be saved into a file and loaded later on in a different program or the same program, or passed over a network or other protocol, saved in a database, etc.
Sample usage is shown below:
Note that many COM objects do not support persistence. In such cases, JComSaveObjectState and JComRestoreObjectState will throw an exception. The COM object must support one of the standard COM persistent interfaces, IPersistStreamInit, IPersistStream, IPersistStorage or IPersistFile. |