public abstract class XMLMetaDataSerializer extends Object implements MetaDataSerializer
APPEND, COMPACT, PRETTY, VERBOSE
Constructor and Description |
---|
XMLMetaDataSerializer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAttribute(String name,
String value)
Add an attribute to the current group.
|
protected void |
addComments(Object obj)
Write the given entity's comments.
|
protected void |
addComments(String[] comments)
Add a comment to the stream.
|
protected void |
addText(String text)
Add text to the current element.
|
protected File |
currentBackupFile()
The backup file made for the current file being parsed.
|
protected void |
endElement(String name)
End the current element.
|
protected Attributes |
getAttributes()
The current attributes.
|
protected Map<File,Collection<Object>> |
getFileMap()
Returns a
Map with keys of the File to be
written to, and values of a Collection of
SourceTracker instances. |
Log |
getLog()
The log to write to.
|
protected abstract Collection<Object> |
getObjects()
Return the current set of objects for serialization.
|
protected File |
getSourceFile(Object obj)
Return the source file for the given instance.
|
protected boolean |
isVerbose()
Whether this serialization is in verbose mode.
|
protected File |
prepareWrite(File file)
Prepare to write to the given file.
|
protected void |
reset()
Reset serialization state for the next document.
|
protected abstract void |
serialize(Collection<Object> objs)
Serialize the given set of objects.
|
void |
serialize(ContentHandler handler,
int flags)
Serilize the current set of objects to a series of SAX events on the
given handler.
|
void |
serialize(File file,
int flags)
Serialize the current set of objects to the given file.
|
void |
serialize(int flags)
Serialize the current set of objects to the files from which they were
parsed.
|
void |
serialize(Map output,
int flags)
Serialize the current set of objects to the files from which they were
parsed.
|
void |
serialize(Result result,
int flags)
Serialize the current set of objects to the given result.
|
void |
serialize(Writer out,
int flags)
Serialize the current set of objects to the given stream.
|
void |
setLog(Log log)
The log to write to.
|
protected void |
startElement(String name)
Start an element with the current attribute settings.
|
public Log getLog()
public void setLog(Log log)
public void serialize(int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
public void serialize(Map output, int flags) throws IOException
MetaDataSerializer
SourceTracker
interface.serialize
in interface MetaDataSerializer
output
- if null, then serialize directly to the file system;
otherwise, populate the specified Map
with
keys that are the File
instances, and
values that are the String
contents of the MetaDataflags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
protected File prepareWrite(File file) throws IOException
IOException
protected Map<File,Collection<Object>> getFileMap()
Map
with keys of the File
to be
written to, and values of a Collection
of
SourceTracker
instances.protected File getSourceFile(Object obj)
SourceTracker
.public void serialize(File file, int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g.
MetaDataSerializer.PRETTY
| MetaDataSerializer.APPEND
IOException
public void serialize(Writer out, int flags) throws IOException
MetaDataSerializer
serialize
in interface MetaDataSerializer
flags
- bit flags specifying the output flags; e.g. MetaDataSerializer.PRETTY
IOException
public void serialize(Result result, int flags) throws SAXException
SAXException
public void serialize(ContentHandler handler, int flags) throws SAXException
SAXException
protected boolean isVerbose()
protected File currentBackupFile()
protected void startElement(String name) throws SAXException
SAXException
protected void endElement(String name) throws SAXException
SAXException
protected void addText(String text) throws SAXException
SAXException
protected void addAttribute(String name, String value)
protected Attributes getAttributes()
protected void addComments(String[] comments) throws SAXException
SAXException
protected void addComments(Object obj) throws SAXException
Commentable
.SAXException
protected void reset()
protected abstract void serialize(Collection<Object> objs) throws SAXException
SAXException
protected abstract Collection<Object> getObjects()
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.