public final class XMLStreamWriterImpl extends AbstractMap implements XMLStreamWriter
AbstractMap in order to support a getter for
implementation-specific properties. For example, you can get
the underlying OutputStream by casting an instance
of this class to Map and calling
getProperty(OUTPUTSTREAM_PROPERTY).| Modifier and Type | Class and Description |
|---|---|
protected class |
XMLStreamWriterImpl.ElementStack |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
static String |
CLOSE_EMPTY_ELEMENT |
static char |
CLOSE_END_TAG |
static char |
CLOSE_START_TAG |
static String |
DEFAULT_ENCODING |
static String |
DEFAULT_XML_VERSION |
static String |
DEFAULT_XMLDECL |
static String |
END_CDATA |
static String |
END_COMMENT |
static String |
OPEN_END_TAG |
static char |
OPEN_START_TAG |
static String |
OUTPUTSTREAM_PROPERTY |
static String |
SPACE |
static String |
START_CDATA |
static String |
START_COMMENT |
static String |
UTF_8 |
| Constructor and Description |
|---|
XMLStreamWriterImpl(OutputStream outputStream,
PropertyManager props)
Creates a new instance of XMLStreamWriterImpl.
|
XMLStreamWriterImpl(OutputStream outputStream,
String encoding,
PropertyManager props)
Creates a new instance of XMLStreamWriterImpl.
|
XMLStreamWriterImpl(StreamResult sr,
String encoding,
PropertyManager props)
Creates a new instance of XMLStreamWriterImpl using a StreamResult.
|
XMLStreamWriterImpl(Writer writer,
PropertyManager props)
Creates a new instance of XMLStreamWriterImpl using a Writer.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReuse()
Can this instance be reused
|
void |
close()
Close this XMLStreamWriter by closing underlying writer.
|
boolean |
containsKey(Object key) |
Set |
entrySet() |
boolean |
equals(Object obj)
Overrides the method defined in AbstractMap
This is required to satisfy the contract for hashCode.
|
void |
flush()
Flush this XMLStreamWriter by flushin underlying writer.
|
Object |
get(Object key)
Returns the value associated to an implementation-specific
property.
|
boolean |
getEscapeCharacters() |
NamespaceContext |
getNamespaceContext()
Return
NamespaceContext being used by the writer. |
String |
getPrefix(String uri)
Return a prefix associated with specified uri, or null if the
uri is unknown.
|
Object |
getProperty(String str)
Returns value associated with the specified property name.
|
int |
hashCode()
Overrides the method defined in AbstractMap
This is required by the toString() method
|
boolean |
isEmpty() |
protected void |
repair()
Correct's namespaces as per requirements of isReparisingNamespace property.
|
void |
reset()
Reset this instance so that it can be re-used.
|
void |
setDefaultNamespace(String uri)
Set the specified URI as default namespace in the current namespace context.
|
void |
setEscapeCharacters(boolean escape) |
void |
setNamespaceContext(NamespaceContext namespaceContext)
Sets the current
NamespaceContext for prefix and uri bindings. |
void |
setOutput(StreamResult sr,
String encoding)
Use a StreamResult to initialize the output for this XMLStreamWriter.
|
void |
setPrefix(String prefix,
String uri)
Sets the prefix the uri is bound to.
|
int |
size() |
String |
toString()
Overrides the method defined in AbstractMap which is
not completely implemented.
|
void |
writeAttribute(String localName,
String value) |
void |
writeAttribute(String namespaceURI,
String localName,
String value) |
void |
writeAttribute(String prefix,
String namespaceURI,
String localName,
String value) |
void |
writeCData(String cdata) |
void |
writeCharacters(char[] data,
int start,
int len) |
void |
writeCharacters(String data) |
void |
writeComment(String comment) |
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String dtd) |
void |
writeEmptyElement(String localName) |
void |
writeEmptyElement(String namespaceURI,
String localName) |
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI) |
void |
writeEndDocument() |
void |
writeEndElement() |
void |
writeEntityRef(String refName) |
void |
writeNamespace(String prefix,
String namespaceURI)
Write a Namespace declaration.
|
void |
writeProcessingInstruction(String target) |
void |
writeProcessingInstruction(String target,
String data) |
void |
writeStartDocument() |
void |
writeStartDocument(String version) |
void |
writeStartDocument(String encoding,
String version) |
void |
writeStartElement(String localName) |
void |
writeStartElement(String namespaceURI,
String localName) |
void |
writeStartElement(String prefix,
String localName,
String namespaceURI) |
clear, clone, containsValue, keySet, put, putAll, remove, valuespublic static final String START_COMMENT
public static final String END_COMMENT
public static final String DEFAULT_ENCODING
public static final String DEFAULT_XMLDECL
public static final String DEFAULT_XML_VERSION
public static final char CLOSE_START_TAG
public static final char OPEN_START_TAG
public static final String OPEN_END_TAG
public static final char CLOSE_END_TAG
public static final String START_CDATA
public static final String END_CDATA
public static final String CLOSE_EMPTY_ELEMENT
public static final String SPACE
public static final String UTF_8
public static final String OUTPUTSTREAM_PROPERTY
public XMLStreamWriterImpl(OutputStream outputStream, PropertyManager props) throws IOException
outputStream - Underlying stream to write the bytes toprops - Properties used by this writerIOExceptionpublic XMLStreamWriterImpl(OutputStream outputStream, String encoding, PropertyManager props) throws IOException
outputStream - Underlying stream to write the bytesencoding - Encoding used to convert chars into bytesprops - Properties used by this writerIOExceptionpublic XMLStreamWriterImpl(Writer writer, PropertyManager props) throws IOException
writer - Underlying writer to which chars are writtenprops - Properties used by this writerIOExceptionpublic XMLStreamWriterImpl(StreamResult sr, String encoding, PropertyManager props) throws IOException
writer - Underlying writer to which chars are writtenprops - Properties used by this writerIOExceptionpublic void reset()
setOutput(StreamResult, encoding) must
be called after this one.public void setOutput(StreamResult sr, String encoding) throws IOException
sr - StreamResult encapsulating output informationencoding - Encoding to be used except when a Writer is availableIOExceptionpublic boolean canReuse()
public void setEscapeCharacters(boolean escape)
public boolean getEscapeCharacters()
public void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamExceptionpublic void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
NamespaceContext being used by the writer.getNamespaceContext in interface XMLStreamWriterpublic String getPrefix(String uri) throws XMLStreamException
getPrefix in interface XMLStreamWriteruri - The namespace uriXMLStreamException - if uri specified is "" or nullpublic Object getProperty(String str) throws IllegalArgumentException
getProperty in interface XMLStreamWriterstr - Property nameIllegalArgumentException - if the specified property is not supportedpublic void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriteruri - Namespace URIXMLStreamExceptionpublic void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException
NamespaceContext for prefix and uri bindings.
This context becomes the root namespace context for writing and
will replace the current root namespace context. Subsequent calls
to setPrefix and setDefaultNamespace will bind namespaces using
the context passed to the method as the root context for resolving
namespaces. This method may only be called once at the start of the
document. It does not cause the namespaces to be declared. If a
namespace URI to prefix mapping is found in the namespace context
it is treated as declared and the prefix may be used by the
XMLStreamWriter.setNamespaceContext in interface XMLStreamWriternamespaceContext - the namespace context to use for this writer, may not be nullXMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix in interface XMLStreamWriterprefix - uri - XMLStreamExceptionpublic void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeCData(String cdata) throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(String data) throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(char[] data,
int start,
int len)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeComment(String comment) throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamExceptionpublic void writeDTD(String dtd) throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEntityRef(String refName) throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamExceptionpublic void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
XMLConstants.NULL_NS_URI,
i.e. there is no Namespace.writeNamespace in interface XMLStreamWriterprefix - Prefix to bind.namespaceURI - NamespaceURI to declare.XMLStreamExceptionpublic void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWritertarget - data - XMLStreamExceptionpublic void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterversion - XMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterencoding - version - XMLStreamExceptionpublic void writeStartElement(String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterlocalName - XMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriternamespaceURI - localName - XMLStreamExceptionpublic void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement in interface XMLStreamWriterprefix - localName - namespaceURI - XMLStreamExceptionprotected void repair()
public int size()
size in interface Mapsize in class AbstractMappublic boolean isEmpty()
isEmpty in interface MapisEmpty in class AbstractMappublic boolean containsKey(Object key)
containsKey in interface MapcontainsKey in class AbstractMappublic Object get(Object key)
get in interface Mapget in class AbstractMappublic Set entrySet()
entrySet in interface MapentrySet in class AbstractMappublic String toString()
toString in class AbstractMappublic int hashCode()
hashCode in interface MaphashCode in class AbstractMappublic boolean equals(Object obj)
equals in interface Mapequals in class AbstractMapCopyright © 2018–2021 mhoffrogge. All rights reserved.