public class XMLEncoder extends Encoder
XMLEncoder
extends Encoder
to write out the
encoded statements and expressions in xml format. The xml can be read by
XMLDecoder
later to restore objects and their states.
The API is similar to ObjectOutputStream
.
Constructor and Description |
---|
XMLEncoder(OutputStream out)
Construct a
XMLEncoder . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Call
flush() first, then write out xml footer and close
the underlying output stream. |
void |
flush()
Writes out all objects since last flush to the output stream.
|
Object |
getOwner()
Returns the owner of this encoder.
|
void |
setOwner(Object owner)
Sets the owner of this encoder.
|
void |
writeExpression(Expression oldExp)
Records the expression so that it can be written out later, then calls
super implementation.
|
void |
writeObject(Object o)
Records the object so that it can be written out later, then calls super
implementation.
|
void |
writeStatement(Statement oldStat)
Records the statement so that it can be written out later, then calls
super implementation.
|
get, getExceptionListener, getPersistenceDelegate, remove, setExceptionListener, setPersistenceDelegate
public XMLEncoder(OutputStream out)
XMLEncoder
.out
- the output stream where xml is written topublic void close()
flush()
first, then write out xml footer and close
the underlying output stream.public void flush()
The implementation write the xml header first if it has not been written. Then all pending objects since last flush are written.
public Object getOwner()
public void setOwner(Object owner)
owner
- the owner to setpublic void writeExpression(Expression oldExp)
writeExpression
in class Encoder
oldExp
- the expression to write. The target, arguments, and return
value of the expression are all old objects.public void writeObject(Object o)
o
- the object to encodepublic void writeStatement(Statement oldStat)
writeStatement
in class Encoder
oldStat
- a statement of old objectsCopyright © 2013. All Rights Reserved.