LibreOffice LibreOffice 25.2 SDK API Reference

Public Member Functions | List of all members
XPersistObject Interface Referencepublished

allows to make UNO objects persistent More...

`import"XPersistObject.idl";`

Inheritance diagram for XPersistObject:

## Public Member Functions
string | getServiceName ()
| gives the service name of the object More...
void | write ([in] com::sun::star::io::XObjectOutputStream OutStream) raises ( com::sun::star::io::IOException )
| writes all the persistent data of the object to the stream. More...
void | read ([in] com::sun::star::io::XObjectInputStream InStream) raises ( com::sun::star::io::IOException )
| reads all the persistent data of the object from the stream. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

allows to make UNO objects persistent

Every UNO object, that wants to be serializable, should implement this interface. The object stores stores itself, when the write method is called.

The object needs to be created before it deserializes itself again (by using the read method). Therefore it must be creatable by name via a factory, which is in general the global service manager. The create and read mechanism is implemented by the com::sun::star::io::ObjectInputStream.

The serialization format (the series of strings, integers, objects) must be specified at the specification of the concrete service.

The interface does not support any special versioning mechanism.

See also
  com::sun::star::io::XObjectOutputStream
  com::sun::star::io::XObjectInputStream

## Member Function Documentation

## ◆ getServiceName()

string getServiceName | ( |  | ) |

gives the service name of the object

This name is used to create such an object by a factory during deserialization.

Returns
  the service name that specifies the behavior and the persistent data format of this implementation.

See also
  com::sun::star::lang::XMultiComponentFactory::getAvailableServiceNames()

## ◆ read()

void read | ( | [in] com::sun::star::io::XObjectInputStream | InStream | ) |
raises | ( | com::sun::star::io::IOException
| ) |  |

reads all the persistent data of the object from the stream.

In case other XPersistObjects are read from the stream, the implementation uses a factory to create these objects (in general the global service manager).

The implementation must read the data in the order documented at the service specification.

Parameters

  InStream | the stream, the data shall be read from.

## ◆ write()

void write | ( | [in] com::sun::star::io::XObjectOutputStream | OutStream | ) |
raises | ( | com::sun::star::io::IOException
| ) |  |

writes all the persistent data of the object to the stream.

The implementation must write the data in the order documented in the service specification.

Parameters

  OutStream | the stream, the data shall be written to. The stream supports simple types and other XPersistObject implementations.

The documentation for this interface was generated from the following file:

- com/sun/star/io/XPersistObject.idl