public class StreamWriterBufferCreator extends AbstractCreator implements XMLStreamWriterEx
XMLStreamWriter that fills MutableXMLStreamBuffer.
TODO: need to retain all attributes/namespaces and then store all namespaces before the attributes. Currently it is necessary for the caller to ensure all namespaces are written before attributes and the caller must not intermix calls to the writeNamespace and writeAttribute methods.
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
attributeValuePrefixes |
_buffer_contentCharactersBuffer, _contentCharactersBufferPtr, _contentObjects, _contentObjectsPtr, _currentContentCharactersBufferFragment, _currentContentObjectFragment, _currentStructureFragment, _currentStructureStringFragment, _structure, _structurePtr, _structureStrings, _structureStringsPtr, CHAR_ARRAY_LENGTH_MEDIUM, CHAR_ARRAY_LENGTH_MEDIUM_SIZE, CHAR_ARRAY_LENGTH_SMALL, CHAR_ARRAY_LENGTH_SMALL_SIZE, CONTENT_TYPE_CHAR_ARRAY, CONTENT_TYPE_CHAR_ARRAY_COPY, CONTENT_TYPE_OBJECT, CONTENT_TYPE_STRING, FLAG_DOCUMENT_FRAGMENT, FLAG_PREFIX, FLAG_QUALIFIED_NAME, FLAG_URI, T_ATTRIBUTE, T_ATTRIBUTE_LN, T_ATTRIBUTE_LN_OBJECT, T_ATTRIBUTE_P_U_LN, T_ATTRIBUTE_P_U_LN_OBJECT, T_ATTRIBUTE_U_LN, T_ATTRIBUTE_U_LN_OBJECT, T_ATTRIBUTE_U_LN_QN, T_ATTRIBUTE_U_LN_QN_OBJECT, T_COMMENT, T_COMMENT_AS_CHAR_ARRAY, T_COMMENT_AS_CHAR_ARRAY_COPY, T_COMMENT_AS_CHAR_ARRAY_MEDIUM, T_COMMENT_AS_CHAR_ARRAY_SMALL, T_COMMENT_AS_STRING, T_DOCUMENT, T_DOCUMENT_FRAGMENT, T_ELEMENT, T_ELEMENT_LN, T_ELEMENT_P_U_LN, T_ELEMENT_U_LN, T_ELEMENT_U_LN_QN, T_END, T_END_OF_BUFFER, T_NAMESPACE_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE_P, T_NAMESPACE_ATTRIBUTE_P_U, T_NAMESPACE_ATTRIBUTE_U, T_PROCESSING_INSTRUCTION, T_TEXT, T_TEXT_AS_CHAR_ARRAY, T_TEXT_AS_CHAR_ARRAY_COPY, T_TEXT_AS_CHAR_ARRAY_MEDIUM, T_TEXT_AS_CHAR_ARRAY_SMALL, T_TEXT_AS_OBJECT, T_TEXT_AS_STRING, T_UNEXPANDED_ENTITY_REFERENCE, TYPE_MASK, VALUE_TYPE_OBJECT, VALUE_TYPE_STRING| Constructor and Description |
|---|
StreamWriterBufferCreator() |
StreamWriterBufferCreator(MutableXMLStreamBuffer buffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
List |
getAttributeValuePrefixes() |
NamespaceContextEx |
getNamespaceContext() |
String |
getPrefix(String namespaceURI) |
Object |
getProperty(String str) |
boolean |
isCheckAttributeValue() |
void |
setCheckAttributeValue(boolean value) |
void |
setDefaultNamespace(String namespaceURI) |
void |
setNamespaceContext(NamespaceContext namespaceContext) |
void |
setPrefix(String prefix,
String namespaceURI) |
protected void |
storeAttribute(String prefix,
String uri,
String localName,
String type,
String value) |
protected void |
storeNamespaceAttribute(String prefix,
String uri) |
protected void |
storeProcessingInstruction(String target,
String data) |
protected void |
storeQualifiedName(int item,
String prefix,
String uri,
String localName) |
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 |
writeBinary(byte[] bytes,
int offset,
int length,
String endpointURL)
Write the binary data.
|
void |
writeBinary(DataHandler dataHandler)
Writes the binary data.
|
OutputStream |
writeBinary(String endpointURL)
Writes the binary data.
|
void |
writeCData(String data) |
void |
writeCharacters(char[] buf,
int start,
int len) |
void |
writeCharacters(String charData) |
void |
writeComment(String str) |
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String str) |
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 str) |
void |
writeNamespace(String prefix,
String namespaceURI) |
void |
writePCDATA(CharSequence charSequence)
Writes like
XMLStreamWriter.writeCharacters(String) but hides
actual data format. |
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) |
createBuffer, getXMLStreamBuffer, increaseTreeCount, peekAtContentObject, resizeContentCharacters, resizeContentObjects, resizeStructure, resizeStructureStrings, setBuffer, setHasInternedStrings, setXMLStreamBuffer, storeContentCharacters, storeContentCharactersCopy, storeContentObject, storeContentString, storeStructure, storeStructureStringpublic StreamWriterBufferCreator()
public StreamWriterBufferCreator(MutableXMLStreamBuffer buffer)
public Object getProperty(String str) throws IllegalArgumentException
getProperty in interface XMLStreamWriterIllegalArgumentExceptionpublic void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamExceptionpublic void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamExceptionpublic NamespaceContextEx getNamespaceContext()
XMLStreamWriterExgetNamespaceContext in interface XMLStreamWritergetNamespaceContext in interface XMLStreamWriterExpublic void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException
setNamespaceContext in interface XMLStreamWriterXMLStreamExceptionpublic void setDefaultNamespace(String namespaceURI) throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void setPrefix(String prefix, String namespaceURI) throws XMLStreamException
setPrefix in interface XMLStreamWriterXMLStreamExceptionpublic String getPrefix(String namespaceURI) throws XMLStreamException
getPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement 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 writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace in interface XMLStreamWriterXMLStreamExceptionpublic 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 data) throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(String charData) throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(char[] buf,
int start,
int len)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeComment(String str) throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamExceptionpublic void writeDTD(String str) throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamExceptionpublic void writeEntityRef(String str) throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writePCDATA(CharSequence charSequence) throws XMLStreamException
XMLStreamWriterExXMLStreamWriter.writeCharacters(String) but hides
actual data format.writePCDATA in interface XMLStreamWriterExcharSequence - The CharSequence that represents the
character infoset items to be written.
The CharSequence is normally a String,
but can be any other CharSequence implementation.
For binary data, however, use of Base64Data is
recommended (so that the consumer interested in seeing it
as binary data may take advantage of mor efficient
data representation.)
XMLStreamExceptionpublic void writeBinary(byte[] bytes,
int offset,
int length,
String endpointURL)
throws XMLStreamException
XMLStreamWriterExConceptually (infoset-wise), this produces the base64-encoded binary data on the output. But this allows implementations like FastInfoset or XOP to do the smart thing.
The use of this method has some restriction to support XOP. Namely, this method must be invoked as a sole content of an element.
(data,start,len) triplet identifies the binary data to be written. After the method invocation, the callee owns the buffer.
writeBinary in interface XMLStreamWriterExendpointURL - this mandatory parameter identifies the MIME type of the binary data.
If the MIME type isn't known by the caller, "application/octet-stream" can
be always used to indicate "I don't know." Never null.XMLStreamExceptionpublic void writeBinary(DataHandler dataHandler) throws XMLStreamException
XMLStreamWriterEx
This method works like the XMLStreamWriterEx.writeBinary(byte[], int, int, String) method,
except that it takes the binary data in the form of DataHandler, which
contains a MIME type (DataHandler.getContentType() as well as the payload
DataHandler.getInputStream().
writeBinary in interface XMLStreamWriterExdataHandler - always non-null. After this method call, the callee owns the data handler.XMLStreamExceptionpublic OutputStream writeBinary(String endpointURL) throws XMLStreamException
XMLStreamWriterEx
This version of the writeBinary method allows the caller to produce
the binary data by writing it to OutputStream.
It is the caller's responsibility to write and close
a stream before it invokes any other methods on XMLStreamWriter.
TODO: experimental. appreciate feedback
writeBinary in interface XMLStreamWriterExendpointURL - See the content-type parameter of
XMLStreamWriterEx.writeBinary(byte[], int, int, String). Must not be null.OutputStream.XMLStreamExceptionprotected void storeQualifiedName(int item,
String prefix,
String uri,
String localName)
protected final void storeAttribute(String prefix, String uri, String localName, String type, String value)
public final List getAttributeValuePrefixes()
protected final void storeProcessingInstruction(String target, String data)
public final boolean isCheckAttributeValue()
public final void setCheckAttributeValue(boolean value)
Copyright © 2005–2017 Oracle Corporation. All rights reserved.