HtmlSerializer
, XmlSerializer
public abstract class Serializer extends Object
Basic abstract serializer - contains common logic for descendants (methods writeXXX()
.
Modifier and Type | Field | Description |
---|---|---|
protected CleanerProperties |
props |
Modifier | Constructor | Description |
---|---|---|
protected |
Serializer(CleanerProperties props) |
Modifier and Type | Method | Description |
---|---|---|
String |
getAsString(String htmlContent) |
|
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)
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.public String getAsString(TagNode tagNode, String charset)
tagNode
- Node to serialize to stringcharset
- Charset of the output - stands in xml declaration partpublic String getAsString(TagNode tagNode, boolean omitEnvelope)
tagNode
- Node to serialize to stringomitEnvelope
- Tells whether to skip open and close tag of the node.IOException
public String getAsString(TagNode tagNode)
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–2018. All rights reserved.