|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gridsystems.GridXMLSerializer
public class GridXMLSerializer
XML Serializer.
The main use of this class is to obtain a human-readable representation of a set of objects, for debugging, tests, etc.
java.io.Writer writer = ...; GridXMLSerializer ser = new GridXMLSerializer(writer); try { ser.begin(); ser.write(obj1); ser.write(obj2); ... ser.end(); } finally { writer.close(); }For each object, the serialization works as follows:
private static final ObjectStreamField[] xmlPersistentFields = { new ObjectStreamField("myField", myClass.class) };Only the specified fields in this array will be serialized.
Constructor Summary | |
---|---|
GridXMLSerializer(java.io.Writer output)
Creates a new instance. |
Method Summary | |
---|---|
void |
begin()
Starts serialization, generating the appropriate XML headers. |
static java.lang.String |
encodeXML(java.lang.String in)
Codifica los caracteres susceptibles de confundir el codigo xml. |
void |
end()
Termina la serializacion, generando el cierre de las cabeceras XML correspondientes Despues de esta operacion se recomienda hacer flush() y close() del writer. |
void |
write(java.lang.Object obj)
Serializa en XML el objeto pasado por parametro. |
void |
write(java.lang.Object obj,
java.lang.String excluded)
Serializa en XML el objeto pasado por parametro. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GridXMLSerializer(java.io.Writer output)
output
- Writer to write toMethod Detail |
---|
public void begin() throws java.io.IOException
java.io.IOException
- If an I/O error occurs writing to the writerpublic void end() throws java.io.IOException
java.io.IOException
- If an I/O error occurs writing to the writerpublic void write(java.lang.Object obj, java.lang.String excluded) throws java.io.IOException
obj
- objeto a serializar en XMLexcluded
- para excluir arboles xml que contengan esta palabra,
ya sea en el nodo raiz como en alguno de sus nodos
hijos (con un nivel de profundidad como maximo)
java.io.IOException
- If an I/O error occurs writing to the writerpublic void write(java.lang.Object obj) throws java.io.IOException
obj
- objeto a serializar en XML
java.io.IOException
- If an I/O error occurs writing to the writerpublic static java.lang.String encodeXML(java.lang.String in)
in
- Cadena con los caracteres a sustituir
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |