Class StreamWriterBufferCreator
- All Implemented Interfaces:
XMLStreamWriter,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.
-
Field Summary
FieldsFields inherited from class com.sun.xml.stream.buffer.AbstractCreator
_bufferFields inherited from class com.sun.xml.stream.buffer.AbstractCreatorProcessor
_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 Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()final ListgetProperty(String str) final booleanfinal voidsetCheckAttributeValue(boolean value) voidsetDefaultNamespace(String namespaceURI) voidsetNamespaceContext(NamespaceContext namespaceContext) voidprotected final voidprotected final voidstoreNamespaceAttribute(String prefix, String uri) protected final voidstoreProcessingInstruction(String target, String data) protected voidstoreQualifiedName(int item, String prefix, String uri, String localName) voidwriteAttribute(String localName, String value) voidwriteAttribute(String namespaceURI, String localName, String value) voidwriteAttribute(String prefix, String namespaceURI, String localName, String value) voidwriteBinary(byte[] bytes, int offset, int length, String endpointURL) Write the binary data.writeBinary(String endpointURL) Writes the binary data.voidwriteBinary(javax.activation.DataHandler dataHandler) Writes the binary data.voidwriteCData(String data) voidwriteCharacters(char[] buf, int start, int len) voidwriteCharacters(String charData) voidwriteComment(String str) voidwriteDefaultNamespace(String namespaceURI) voidvoidwriteEmptyElement(String localName) voidwriteEmptyElement(String namespaceURI, String localName) voidwriteEmptyElement(String prefix, String localName, String namespaceURI) voidvoidvoidwriteEntityRef(String str) voidwriteNamespace(String prefix, String namespaceURI) voidwritePCDATA(CharSequence charSequence) Writes likeXMLStreamWriter.writeCharacters(String)but hides actual data format.voidwriteProcessingInstruction(String target) voidwriteProcessingInstruction(String target, String data) voidvoidwriteStartDocument(String version) voidwriteStartDocument(String encoding, String version) voidwriteStartElement(String localName) voidwriteStartElement(String namespaceURI, String localName) voidwriteStartElement(String prefix, String localName, String namespaceURI) Methods inherited from class com.sun.xml.stream.buffer.AbstractCreator
createBuffer, getXMLStreamBuffer, increaseTreeCount, peekAtContentObject, resizeContentCharacters, resizeContentObjects, resizeStructure, resizeStructureStrings, setBuffer, setHasInternedStrings, setXMLStreamBuffer, storeContentCharacters, storeContentCharactersCopy, storeContentObject, storeContentString, storeStructure, storeStructureString
-
Field Details
-
attributeValuePrefixes
-
-
Constructor Details
-
StreamWriterBufferCreator
public StreamWriterBufferCreator() -
StreamWriterBufferCreator
-
-
Method Details
-
getProperty
- Specified by:
getPropertyin interfaceXMLStreamWriter- Throws:
IllegalArgumentException
-
close
- Specified by:
closein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
flush
- Specified by:
flushin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
getNamespaceContext
Description copied from interface:XMLStreamWriterEx- Specified by:
getNamespaceContextin interfaceXMLStreamWriter- Specified by:
getNamespaceContextin interfaceXMLStreamWriterEx
-
setNamespaceContext
- Specified by:
setNamespaceContextin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setDefaultNamespace
- Specified by:
setDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
setPrefix
- Specified by:
setPrefixin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
getPrefix
- Specified by:
getPrefixin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartDocument
- Specified by:
writeStartDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndDocument
- Specified by:
writeEndDocumentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeStartElement
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException - Specified by:
writeStartElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException - Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEndElement
- Specified by:
writeEndElementin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDefaultNamespace
- Specified by:
writeDefaultNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeNamespace
- Specified by:
writeNamespacein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
- Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException - Specified by:
writeAttributein interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCData
- Specified by:
writeCDatain interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeComment
- Specified by:
writeCommentin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeDTD
- Specified by:
writeDTDin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeEntityRef
- Specified by:
writeEntityRefin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXMLStreamWriter- Throws:
XMLStreamException
-
writePCDATA
Description copied from interface:XMLStreamWriterExWrites likeXMLStreamWriter.writeCharacters(String)but hides actual data format.- Specified by:
writePCDATAin interfaceXMLStreamWriterEx- Parameters:
charSequence- TheCharSequencethat represents the character infoset items to be written.The
CharSequenceis normally aString, but can be any otherCharSequenceimplementation. For binary data, however, use ofBase64Datais recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)- Throws:
XMLStreamException
-
writeBinary
public void writeBinary(byte[] bytes, int offset, int length, String endpointURL) throws XMLStreamException Description copied from interface:XMLStreamWriterExWrite the binary data.Conceptually (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.
- Specified by:
writeBinaryin interfaceXMLStreamWriterExendpointURL- 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.- Throws:
XMLStreamException
-
writeBinary
Description copied from interface:XMLStreamWriterExWrites the binary data.This method works like the
XMLStreamWriterEx.writeBinary(byte[], int, int, String)method, except that it takes the binary data in the form ofDataHandler, which contains a MIME type (DataHandler.getContentType()as well as the payloadDataHandler.getInputStream().- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
dataHandler- always non-null. After this method call, the callee owns the data handler.- Throws:
XMLStreamException
-
writeBinary
Description copied from interface:XMLStreamWriterExWrites the binary data.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- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
endpointURL- See the content-type parameter ofXMLStreamWriterEx.writeBinary(byte[], int, int, String). Must not be null.- Returns:
- always return a non-null
OutputStream. - Throws:
XMLStreamException
-
storeQualifiedName
-
storeNamespaceAttribute
-
storeAttribute
-
getAttributeValuePrefixes
-
storeProcessingInstruction
-
isCheckAttributeValue
public final boolean isCheckAttributeValue() -
setCheckAttributeValue
public final void setCheckAttributeValue(boolean value)
-