Top Description Fields Constructors Methods
org.codehaus.stax2.ri

public Class Stax2WriterAdapter

extends StreamWriterDelegate
implements XMLStreamWriter2, XMLStreamConstants
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLStreamConstants, org.codehaus.stax2.XMLStreamWriter2, org.codehaus.stax2.validation.Validatable, org.codehaus.stax2.typed.TypedXMLStreamWriter, javax.xml.stream.XMLStreamWriter
Imports
java.math.BigDecimal, .BigInteger, javax.xml.namespace.NamespaceContext, .QName, javax.xml.stream.*, org.codehaus.stax2.*, org.codehaus.stax2.ri.typed.SimpleValueEncoder, org.codehaus.stax2.typed.Base64Variant, .Base64Variants, org.codehaus.stax2.util.StreamWriterDelegate, org.codehaus.stax2.validation.ValidationProblemHandler, .XMLValidationSchema, .XMLValidator

This adapter implements parts of XMLStreamWriter2, the extended stream writer defined by Stax2 extension, by wrapping a vanilla Stax 1.0 XMLStreamReader implementation.

Note: the implementation is incomplete as-is, since not all features needed are accessible via basic Stax 1.0 interface. As such, two main use cases for this wrapper are:

Field Summary

Modifier and TypeField and Description
protected String
mEncoding

Encoding we have determined to be used, according to method calls (write start document etc.)

protected final boolean
protected SimpleValueEncoder
Inherited from org.codehaus.stax2.util.StreamWriterDelegate:
mDelegate

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
closeCompletely()

Implements org.codehaus.stax2.XMLStreamWriter2.closeCompletely.

Method similar to javax.xml.stream.XMLStreamWriter#close(), except that this method also does close the underlying output destination (stream) if it has not yet been closed.
public void
copyEventFromReader(XMLStreamReader2
Reader to use for accessing event to copy
sr
,
boolean
If true, writer is not allowed to change the state of the reader (so that all the data associated with the current event has to be preserved); if false, writer is allowed to use methods that may cause some data to be discarded. Setting this to false may improve the performance, since it may allow full no-copy streaming of data, especially textual contents.
preserveEventData
)

Implements org.codehaus.stax2.XMLStreamWriter2.copyEventFromReader.

Method that essentially copies event that the specified reader has just read.
protected void
public String
getEncoding()

Implements org.codehaus.stax2.XMLStreamWriter2.getEncoding.

Method that can be called to get information about encoding that this writer is using (or at least claims is using).
public XMLStreamLocation2
getLocation()

Implements org.codehaus.stax2.XMLStreamWriter2.getLocation.

Method that should return current output location, if the writer keeps track of it; null if it does not.
protected SimpleValueEncoder
public boolean
isPropertySupported(String name)

Implements org.codehaus.stax2.XMLStreamWriter2.isPropertySupported.

Method similar to javax.xml.stream.XMLOutputFactory#isPropertySupported, used to determine whether a property is supported by the Writer instance.
protected String
serializeQNameValue(QName name)

Method called to serialize given qualified name into valid String serialization, taking into account existing namespace bindings.

public boolean
setProperty(String
Name of the property to set
name
,
Object
Value to set property to.
value
)

Implements org.codehaus.stax2.XMLStreamWriter2.setProperty.

Method that can be used to set per-writer properties; a subset of properties one can set via matching org.codehaus.stax2.XMLOutputFactory2 instance.
public ValidationProblemHandler
setValidationProblemHandler(ValidationProblemHandler
Handler to install, if non null; if null, indicates that the default (implementation-specific) handling should be used
h
)

Implements org.codehaus.stax2.validation.Validatable.setValidationProblemHandler.

Method that application can call to define a custom handler for validation problems encountered during validation process.
public XMLValidator
stopValidatingAgainst(XMLValidationSchema schema)

Implements org.codehaus.stax2.validation.Validatable.stopValidatingAgainst.

Method that can be called by application to stop validating output against a schema, for which validateAgainst was called earlier.
public XMLValidator
stopValidatingAgainst(XMLValidator validator)

Implements org.codehaus.stax2.validation.Validatable.stopValidatingAgainst.

Method that can be called by application to stop validating output using specified validator.
public XMLValidator
validateAgainst(XMLValidationSchema schema)

Implements org.codehaus.stax2.validation.Validatable.validateAgainst.

Method that will construct a XMLValidator instance from the given schema (unless a validator for that schema has already been added), initialize it if necessary, and make validatable object (reader, writer) call appropriate validation methods from this point on until the end of the document (that is, it's not scoped with sub-trees), or until validator is removed by an explicit call to stopValidatingAgainst.
public static XMLStreamWriter2
wrapIfNecessary(XMLStreamWriter sw)

Method that should be used to add dynamic support for XMLStreamWriter2.

public void
public void
writeBinary(byte[]
The array from which to write the bytes.
value
,
int
The index in the array from which writing starts.
from
,
int
The number of bytes to write.
length
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBinary.

Write binary content as base64 encoded characters to the output.

public void
writeBinaryAttribute(String
The attribute's prefix.
prefix
,
String
The attribute's URI.
nsURI
,
String
The attribute's local name.
localName
,
byte[]
The array from which to write the bytes.
value
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBinaryAttribute.

Write a byte array attribute.

public void
public void
writeBoolean(boolean
The boolean value to write.
b
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBoolean.

Write a boolean value to the output as textual element content.
public void
writeBooleanAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
nsURI
,
String
The attribute's local name
localName
,
boolean
The boolean value to write.
b
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBooleanAttribute.

Write a boolean value to the output as attribute value.
public void
writeCData(char[] text, int start, int len)

Implements org.codehaus.stax2.XMLStreamWriter2.writeCData.

public void
writeDecimal(BigDecimal value)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDecimal.

Write a decimal value to the output as textual element content.
public void
public void
writeDouble(double value)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDouble.

Write a double value to the output as textual element content.
public void
public void
public void
public void
writeDTD(String rootName, String systemId, String publicId, String internalSubset)

Implements org.codehaus.stax2.XMLStreamWriter2.writeDTD.

public void
writeFloat(float value)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeFloat.

Write a float value to the output as textual element content.
public void
public void
public void
public void
writeFullEndElement()

Implements org.codehaus.stax2.XMLStreamWriter2.writeFullEndElement.

Method similar to writeEndElement, but that will always write the full end element, instead of empty element.
public void
writeInt(int value)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeInt.

Write an int value to the output as textual element content.
public void
writeIntArray(int[]
The array from which to write the ints.
value
,
int
The index in the array from which writing starts.
from
,
int
The number of ints to write.
length
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntArray.

Write int array to the output.

public void
writeIntArrayAttribute(String
The attribute's prefix.
prefix
,
String
The attribute's URI.
nsURI
,
String
The attribute's local name.
localName
,
int[]
The array from which to write the ints.
value
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntArrayAttribute.

Write int array attribute.

public void
writeIntAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
nsURI
,
String
The attribute's local name
localName
,
int
The integer value to write.
value
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntAttribute.

Write an integer value to the output as attribute value.
public void
public void
public void
writeLong(long value)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLong.

Write a long value to the output as textual element content.
public void
public void
public void
writeLongAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
nsURI
,
String
The attribute's local name
localName
,
long
The long value to write.
value
)

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLongAttribute.

Write an long value to the output as attribute value.
public void
public void
public void
writeRaw(String text)

Implements org.codehaus.stax2.XMLStreamWriter2.writeRaw.

Method that writes specified content as is, without encoding or deciphering it in any way.
public void
writeRaw(String text, int offset, int len)

Implements org.codehaus.stax2.XMLStreamWriter2.writeRaw.

Method that writes specified content as is, without encoding or deciphering it in any way.
public void
writeRaw(char[] text, int offset, int length)

Implements org.codehaus.stax2.XMLStreamWriter2.writeRaw.

Method that writes specified content as is, without encoding or deciphering it in any way.
public void
writeSpace(String text)

Implements org.codehaus.stax2.XMLStreamWriter2.writeSpace.

Method that can be called to write whitespace-only content.
public void
writeSpace(char[] text, int offset, int length)

Implements org.codehaus.stax2.XMLStreamWriter2.writeSpace.

Method that can be called to write whitespace-only content.
public void
Inherited from org.codehaus.stax2.util.StreamWriterDelegate:
closeflushgetNamespaceContextgetParentgetPrefixgetPropertysetDefaultNamespacesetNamespaceContextsetParentsetPrefixwriteAttributewriteAttributewriteAttributewriteCDatawriteCharacterswriteCharacterswriteCommentwriteDefaultNamespacewriteDTDwriteEmptyElementwriteEmptyElementwriteEmptyElementwriteEndDocumentwriteEndElementwriteEntityRefwriteNamespacewriteProcessingInstructionwriteProcessingInstructionwriteStartDocumentwriteStartDocumentwriteStartDocumentwriteStartElementwriteStartElementwriteStartElement