|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.io.serial.Serializer
public abstract class Serializer
This is an interface for serializing XQuery values.
Field Summary | |
---|---|
protected byte[] |
elem
Current tag. |
protected boolean |
indent
Indentation flag. |
protected int |
level
Current level. |
static SerializerProp |
PROPS
Default serialization parameters. |
protected TokenList |
tags
Stack with opened tag names. |
protected boolean |
undecl
Undeclare prefixes. |
Constructor Summary | |
---|---|
Serializer()
|
Method Summary | |
---|---|
protected abstract void |
atomic(Item item)
Serializes an atomic value. |
protected abstract void |
attribute(byte[] name,
byte[] value)
Serializes an attribute. |
void |
close()
Closes the serializer. |
protected void |
closeDoc()
Closes a document. |
protected void |
closeElement()
Closes an element. |
protected void |
closeResult()
Closes a result. |
protected abstract void |
finishClose()
Closes an element. |
protected abstract void |
finishComment(byte[] value)
Serializes a comment. |
boolean |
finished()
Tests if the serialization was interrupted. |
protected abstract void |
finishEmpty()
Closes an empty element. |
protected abstract void |
finishOpen()
Finishes an opening element node. |
protected abstract void |
finishPi(byte[] name,
byte[] value)
Serializes a processing instruction. |
protected abstract void |
finishText(byte[] value)
Serializes a text. |
protected void |
finishText(byte[] value,
FTPos ftp)
Serializes a text. |
static XMLSerializer |
get(java.io.OutputStream os)
Returns an XML serializer. |
static Serializer |
get(java.io.OutputStream os,
SerializerProp props)
Returns a specific serializer. |
protected void |
namespace(byte[] pref,
byte[] uri)
Serializes a namespace if it has not been serialized by an ancestor yet. |
protected byte[] |
nsUri(byte[] pref)
Gets the namespace URI currently bound by the given prefix. |
protected void |
openDoc(byte[] name)
Opens a document. |
protected void |
openResult()
Starts a result. |
void |
reset()
Resets the serializer (indentation, etc). |
void |
serialize(Item item)
Serializes the specified item, which may be a node or an atomic value. |
protected void |
startElement(byte[] name)
Opens an element. |
protected abstract void |
startOpen(byte[] name)
Starts an element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SerializerProp PROPS
protected final TokenList tags
protected int level
protected byte[] elem
protected boolean undecl
protected boolean indent
Constructor Detail |
---|
public Serializer()
Method Detail |
---|
public static XMLSerializer get(java.io.OutputStream os) throws java.io.IOException
os
- output stream reference
java.io.IOException
- I/O exceptionpublic static Serializer get(java.io.OutputStream os, SerializerProp props) throws java.io.IOException
os
- output stream referenceprops
- serialization properties (can be null
)
java.io.IOException
- I/O exceptionpublic final void serialize(Item item) throws java.io.IOException
item
- item to be serialized
java.io.IOException
- I/O exceptionpublic void close() throws java.io.IOException
java.io.IOException
- I/O exceptionpublic boolean finished()
public void reset()
protected final void startElement(byte[] name) throws java.io.IOException
name
- element name
java.io.IOException
- I/O exceptionprotected final void closeElement() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected void finishText(byte[] value, FTPos ftp) throws java.io.IOException
value
- valueftp
- full-text positions, used for visualization highlighting
java.io.IOException
- I/O exceptionprotected final byte[] nsUri(byte[] pref)
pref
- namespace prefix
null
otherwiseprotected void namespace(byte[] pref, byte[] uri) throws java.io.IOException
pref
- prefixuri
- URI
java.io.IOException
- I/O exceptionprotected void openResult() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected void closeResult() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected void openDoc(byte[] name) throws java.io.IOException
name
- name
java.io.IOException
- I/O exceptionprotected void closeDoc() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected abstract void attribute(byte[] name, byte[] value) throws java.io.IOException
name
- namevalue
- value
java.io.IOException
- I/O exceptionprotected abstract void startOpen(byte[] name) throws java.io.IOException
name
- tag name
java.io.IOException
- I/O exceptionprotected abstract void finishOpen() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected abstract void finishEmpty() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected abstract void finishClose() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected abstract void finishText(byte[] value) throws java.io.IOException
value
- value
java.io.IOException
- I/O exceptionprotected abstract void finishComment(byte[] value) throws java.io.IOException
value
- value
java.io.IOException
- I/O exceptionprotected abstract void finishPi(byte[] name, byte[] value) throws java.io.IOException
name
- namevalue
- value
java.io.IOException
- I/O exceptionprotected abstract void atomic(Item item) throws java.io.IOException
item
- item
java.io.IOException
- I/O exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |