public abstract class Serializer extends Object
Basic abstract serializer - contains common logic for descendants (methods writeXXX()
.
Modifier and Type | Field and Description |
---|---|
protected CleanerProperties |
props |
Modifier | Constructor and Description |
---|---|
protected |
Serializer(CleanerProperties props) |
Modifier and Type | Method and Description |
---|---|
String |
getAsString(TagNode tagNode) |
String |
getAsString(TagNode tagNode,
boolean omitEnvelope) |
String |
getAsString(TagNode tagNode,
String charset) |
String |
getAsString(TagNode tagNode,
String charset,
boolean omitEnvelope) |
protected boolean |
isScriptOrStyle(TagNode tagNode) |
protected abstract void |
serialize(TagNode tagNode,
Writer writer) |
void |
write(TagNode tagNode,
Writer writer,
String charset)
Writes specified node using specified writer.
|
void |
write(TagNode tagNode,
Writer writer,
String charset,
boolean omitEnvelope)
Writes specified node using specified writer.
|
void |
writeToFile(TagNode tagNode,
String fileName)
Writes specified TagNode to the file, using system default charset.
|
void |
writeToFile(TagNode tagNode,
String fileName,
boolean omitEnvelope)
Writes specified TagNode to the file, using specified charset and optionally omits node envelope
(skips open and close tags of the node).
|
void |
writeToFile(TagNode tagNode,
String fileName,
String charset)
Writes specified TagNode to the file, using specified charset.
|
void |
writeToFile(TagNode tagNode,
String fileName,
String charset,
boolean omitEnvelope)
Writes specified TagNode to the file, using specified charset and optionally omits node envelope
(skips open and close tags of the node).
|
void |
writeToStream(TagNode tagNode,
OutputStream out)
Writes specified TagNode to the output stream, using system default charset.
|
void |
writeToStream(TagNode tagNode,
OutputStream out,
boolean omitEnvelope)
Writes specified TagNode to the output stream, using system default charset and optionally omits node envelope
(skips open and close tags of the node).
|
void |
writeToStream(TagNode tagNode,
OutputStream out,
String charset)
Writes specified TagNode to the output stream, using specified charset.
|
void |
writeToStream(TagNode tagNode,
OutputStream out,
String charset,
boolean omitEnvelope)
Writes specified TagNode to the output stream, using specified charset and optionally omits node envelope
(skips open and close tags of the node).
|
protected CleanerProperties props
protected Serializer(CleanerProperties props)
public void writeToStream(TagNode tagNode, OutputStream out, String charset, boolean omitEnvelope) throws IOException
tagNode
- Node to be writtenout
- Output streamcharset
- Charset of the outputomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public void writeToStream(TagNode tagNode, OutputStream out, String charset) throws IOException
tagNode
- Node to be writtenout
- Output streamcharset
- Charset of the outputIOException
public void writeToStream(TagNode tagNode, OutputStream out, boolean omitEnvelope) throws IOException
tagNode
- Node to be writtenout
- Output streamomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public void writeToStream(TagNode tagNode, OutputStream out) throws IOException
tagNode
- Node to be writtenout
- Output streamIOException
public void writeToFile(TagNode tagNode, String fileName, String charset, boolean omitEnvelope) throws IOException
tagNode
- Node to be writtenfileName
- Output file namecharset
- Charset of the outputomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public void writeToFile(TagNode tagNode, String fileName, String charset) throws IOException
tagNode
- Node to be writtenfileName
- Output file namecharset
- Charset of the outputIOException
public void writeToFile(TagNode tagNode, String fileName, boolean omitEnvelope) throws IOException
tagNode
- Node to be writtenfileName
- Output file nameomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public void writeToFile(TagNode tagNode, String fileName) throws IOException
tagNode
- Node to be writtenfileName
- Output file nameIOException
public String getAsString(TagNode tagNode, String charset, boolean omitEnvelope) throws IOException
tagNode
- Node to serialize to stringcharset
- Charset of the output - stands in xml declaration partomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public String getAsString(TagNode tagNode, String charset) throws IOException
tagNode
- Node to serialize to stringcharset
- Charset of the output - stands in xml declaration partIOException
public String getAsString(TagNode tagNode, boolean omitEnvelope) throws IOException
tagNode
- Node to serialize to stringomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public String getAsString(TagNode tagNode) throws IOException
tagNode
- Node to serialize to stringIOException
public void write(TagNode tagNode, Writer writer, String charset) throws IOException
tagNode
- Node to serialize.writer
- Writer instancecharset
- Charset of the outputIOException
public void write(TagNode tagNode, Writer writer, String charset, boolean omitEnvelope) throws IOException
tagNode
- Node to serialize.writer
- Writer instancecharset
- Charset of the outputomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
protected boolean isScriptOrStyle(TagNode tagNode)
protected abstract void serialize(TagNode tagNode, Writer writer) throws IOException
IOException
Copyright © 2006–2014. All rights reserved.