public class PersistenceManager
extends java.lang.Object
registerClassDelegate(java.lang.Class, java.beans.PersistenceDelegate)
and
unregisterClassDelegate(java.lang.Class)
.
In most cases you can use databox to process the XML input/output. More information about XML persistence, see XMLEncoder/XMLDecoder in Java Swing.
Modifier and Type | Field and Description |
---|---|
static java.beans.PersistenceDelegate |
DEFAULT_DElEGATE
This default delegate used to encode/decode the properties
which has no special delegate registered.
|
static java.beans.PersistenceDelegate |
TRANSIENT_DELEGATE
Transient delegate used to deal with all transient properties.
|
Modifier and Type | Method and Description |
---|---|
static ClientPropertyPersistentFilter |
getClientPropertyFilter()
Get the client property filter.
|
static TDataBox |
readByBinary(boolean compressed,
byte[] data)
Read a databox object and all contained data back from a binary array.
|
static void |
readByXML(TDataBox box,
java.io.InputStream in,
Element parentOfRootElement)
Read data from xml into specified databox.
|
static void |
readByXML(TDataBox box,
java.lang.String data,
Element parentOfRootElement) |
static void |
registerClassDelegate(java.lang.Class clazz,
java.beans.PersistenceDelegate delegate)
Register a class delegate for specified class type.
|
static void |
setClientPropertyFilter(ClientPropertyPersistentFilter clientPropertyFilter)
Set the client property filter.
|
static void |
unregisterClassDelegate(java.lang.Class clazz)
Unregister a class delegate for specified class type.
|
static byte[] |
writeByBinary(TDataBox box,
boolean compressed)
Output databox and all contained data into a binary byte array.
|
static java.lang.String |
writeByXML(TDataBox box,
boolean withElementId)
Write out databox data into xml and return the xml string.
|
static void |
writeByXML(TDataBox box,
boolean withElementId,
boolean withAlarmId,
boolean withAlarmState,
java.io.OutputStream out,
ElementPersistentFilter elementFilter,
ClientPropertyPersistentFilter clientPropertyFilter)
Write out databox data into the output stream with xml format.
|
static void |
writeByXML(TDataBox box,
DataBoxOutputSetting outputSetting)
Write out databox data with xml format with the specified DataBoxOutputSetting.
|
public static final java.beans.PersistenceDelegate TRANSIENT_DELEGATE
public static final java.beans.PersistenceDelegate DEFAULT_DElEGATE
public static ClientPropertyPersistentFilter getClientPropertyFilter()
setClientPropertyFilter}
public static void setClientPropertyFilter(ClientPropertyPersistentFilter clientPropertyFilter)
clientPropertyFilter
- ClientPropertyPersistentFilter
the client property persistent filter.#getClientPropertyFilter}
public static void registerClassDelegate(java.lang.Class clazz, java.beans.PersistenceDelegate delegate)
clazz
- Class class typedelegate
- PersistenceDelegate the new delegate for this class type.unregisterClassDelegate}
public static void unregisterClassDelegate(java.lang.Class clazz)
clazz
- Class the delegate related class typeregisterClassDelegate}
public static java.lang.String writeByXML(TDataBox box, boolean withElementId) throws java.io.IOException
box
- TDataBox databox will outputwithElementId
- boolean whether output element id into xml.java.io.IOException
- if any I/O error occurpublic static void writeByXML(TDataBox box, boolean withElementId, boolean withAlarmId, boolean withAlarmState, java.io.OutputStream out, ElementPersistentFilter elementFilter, ClientPropertyPersistentFilter clientPropertyFilter) throws java.io.IOException
box
- TDataBox the databox of the data sourcewithElementId
- boolean whether output element idwithAlarmId
- boolean whether output alarm idwithAlarmState
- boolean whether output alarm state.out
- OutputStream output streamelementFilter
- ElementPersistentFilter element persistent filterclientPropertyFilter
- ClientPropertyPersistentFilter client property persistent filter.java.io.IOException
- if any I/O error occurpublic static void writeByXML(TDataBox box, DataBoxOutputSetting outputSetting) throws java.io.IOException
box
- TDataBox the databox of the data sourceoutputSetting
- the output setting params.java.io.IOException
- if any I/O error occurpublic static void readByXML(TDataBox box, java.lang.String data, Element parentOfRootElement) throws java.io.IOException
java.io.IOException
public static void readByXML(TDataBox box, java.io.InputStream in, Element parentOfRootElement) throws java.io.IOException
box
- TDataBox databox data will read intoin
- InputStream input streamparentOfRootElement
- Element root parent element of all read elements.java.io.IOException
- If any I/O error occurpublic static byte[] writeByBinary(TDataBox box, boolean compressed) throws java.io.IOException
box
- TDataBox the databox object need to write outcompressed
- boolean whether need to compress the result byte array.java.io.IOException
- if any I/O error occurpublic static TDataBox readByBinary(boolean compressed, byte[] data) throws java.io.IOException, java.lang.ClassNotFoundException
compressed
- boolean whether the binary array is compresseddata
- byte[] the binary array contains databox object and all contained data.java.io.IOException
- if any I/O error occurjava.lang.ClassNotFoundException
- If any class type can not be foundCopyright © 2002 - 2010 Serva Software. All Rights Reserved.