Top Description Fields Constructors Methods
com.ctc.wstx.sw

public abstract Class TypedStreamWriter

extends BaseStreamWriter
Class Inheritance
Known Direct Subclasses
com.ctc.wstx.sw.BaseNsStreamWriter, com.ctc.wstx.sw.NonNsStreamWriter
Imports
java.io.IOException, java.math.BigDecimal, .BigInteger, javax.xml.namespace.QName, javax.xml.stream.XMLStreamException, org.codehaus.stax2.typed.Base64Variant, .Base64Variants, org.codehaus.stax2.ri.typed.AsciiValueEncoder, .ValueEncoderFactory, org.codehaus.stax2.validation.XMLValidator, com.ctc.wstx.api.WriterConfig, com.ctc.wstx.cfg.ErrorConsts, com.ctc.wstx.exc.WstxIOException

Intermediate base class that implements Typed Access API (Stax2 v3) for all (repairing, non-repairing, non-namespace) native stream writer implementations.

Field Summary

Modifier and TypeField and Description
protected ValueEncoderFactory
mValueEncoderFactory

When outputting using Typed Access API, we will need encoders.

Inherited from com.ctc.wstx.sw.BaseStreamWriter:
ATTR_MIN_ARRAYCOPYCHAR_SPACEDEFAULT_COPYBUFFER_LENmAnyOutputmCfgAutomaticEmptyElemsmCfgCDataAsTextmCfgCopyDefaultAttrsmCheckAttrsmCheckStructuremConfigmCopyBuffermDtdRootElemmEmptyElementmEncodingMIN_ARRAYCOPYmReturnNullForDefaultNamespacemStartElementOpenmStatemValidatormVldContentmVldProbHandlermWritermXml11STATE_EPILOGSTATE_PROLOGSTATE_TREE

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private String
protected final ValueEncoderFactory
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
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.
value
)

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.
value
)

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

Write a boolean value to the output as attribute value.

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
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
writeInt(int value)

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

Write an int value to the output as textual element content.

public final 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
protected abstract void
writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc)

Method that will write attribute with value that is known not to require additional escaping.

protected final void
Inherited from com.ctc.wstx.sw.BaseStreamWriter:
addDefaultAttributeclosecloseCompletelycloseStartElementcopyEventFromReadercopyStartElementdoReportProblemdoReportProblemdoWriteStartDocumentfindAttributeIndexflushgetAttributeCountgetAttributeLocalNamegetAttributeNamespacegetAttributePrefixgetAttributeTypegetAttributeValuegetAttributeValuegetBaseUrigetCopyBuffergetCopyBuffergetCurrentElementNamegetEncodinggetLocationgetNamespaceContextgetNamespaceURIgetPrefixgetPropertygetTopElementDescgetValidationLocationgetXmlVersioninPrologOrEpilogisNotationDeclaredisPropertySupportedisUnparsedEntityDeclaredisValidatingreportIllegalArgreportIllegalMethodreportInvalidContentreportNwfAttrreportNwfAttrreportNwfContentreportNwfContentreportNwfStructurereportNwfStructurereportProblemreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemreportValidationProblemsetDefaultNamespacesetNamespaceContextsetPrefixsetPropertysetValidationProblemHandlerstopValidatingAgainststopValidatingAgainstthrowFromIOEthrowOutputErrorthrowOutputErrortoStringvalidateAgainstvalidateQNamePrefixverifyRootElementverifyWriteCDataverifyWriteDTDwrapAsRawWriterwrapAsTextWriterwriteAttributewriteAttributewriteAttributewriteCDatawriteCDatawriteCharacterswriteCharacterswriteCharacterswriteCommentwriteDefaultNamespacewriteDTDwriteDTDwriteDTDwriteEmptyElementwriteEmptyElementwriteEmptyElementwriteEndDocumentwriteEndElementwriteEndElementwriteEntityRefwriteFullEndElementwriteNamespacewriteProcessingInstructionwriteProcessingInstructionwriteRawwriteRawwriteRawwriteSpacewriteSpacewriteStartDocumentwriteStartDocumentwriteStartDocumentwriteStartDocumentwriteStartElementwriteStartElementwriteStartElementwriteStartElement

Field Detail

mValueEncoderFactoryback to summary
protected ValueEncoderFactory mValueEncoderFactory

When outputting using Typed Access API, we will need encoders. If so, they will created by lazily-constructed factory

Constructor Detail

TypedStreamWriterback to summary
protected TypedStreamWriter(XmlWriter xw, String enc, WriterConfig cfg)

Method Detail

serializeQNameback to summary
private String serializeQName(QName name) throws XMLStreamException
valueEncoderFactoryback to summary
protected final ValueEncoderFactory valueEncoderFactory()
writeBinaryback to summary
public void writeBinary(byte[] value, int from, int length) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBinary.

Write binary content as base64 encoded characters to the output. The lexical representation of a byte array is defined by the XML Schema base64Binary data type. This method can be called multiple times to write the array in chunks; but if so, callers should write output in chunks divisible by 3 (natural atomic unit of base64 output, which avoids padding) to maximize interoperability.

Note

base64 variant defaults to Base64Variants#MIME.

Parameters
value:byte[]

The array from which to write the bytes.

from:int

The index in the array from which writing starts.

length:int

The number of bytes to write.

Annotations
@Override
writeBinaryback to summary
public void writeBinary(Base64Variant v, byte[] value, int from, int length) throws XMLStreamException

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

Annotations
@Override
writeBinaryAttributeback to summary
public void writeBinaryAttribute(String prefix, String nsURI, String localName, byte[] value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBinaryAttribute.

Write a byte array attribute. The lexical representation of a byte array is defined by the XML Schema base64Binary data type.

Note

base64 variant defaults to Base64Variants#MIME.

Parameters
prefix:String

The attribute's prefix.

nsURI:String

The attribute's URI.

localName:String

The attribute's local name.

value:byte[]

The array from which to write the bytes.

Annotations
@Override
writeBinaryAttributeback to summary
public void writeBinaryAttribute(Base64Variant v, String prefix, String nsURI, String localName, byte[] value) throws XMLStreamException

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

Annotations
@Override
writeBooleanback to summary
public void writeBoolean(boolean value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBoolean.

Write a boolean value to the output as textual element content. The lexical representation of content is defined by the XML Schema boolean data type.

Parameters
value:boolean

The boolean value to write.

Annotations
@Override
writeBooleanAttributeback to summary
public void writeBooleanAttribute(String prefix, String nsURI, String localName, boolean value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeBooleanAttribute.

Write a boolean value to the output as attribute value. The lexical representation of content is defined by the XML Schema boolean data type.

Parameters
prefix:String

The attribute's prefix. Null or "" if no prefix is to be used

nsURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:boolean

The boolean value to write.

Annotations
@Override
writeDecimalback to summary
public void writeDecimal(BigDecimal value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDecimal.

Write a decimal value to the output as textual element content. The lexical representation of content is defined by the XML Schema decimal data type.

Annotations
@Override
writeDecimalAttributeback to summary
public void writeDecimalAttribute(String prefix, String nsURI, String localName, BigDecimal value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDecimalAttribute.

Annotations
@Override
writeDoubleback to summary
public void writeDouble(double value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDouble.

Write a double value to the output as textual element content. The lexical representation of content is defined by the XML Schema double data type.

Annotations
@Override
writeDoubleArrayback to summary
public void writeDoubleArray(double[] value, int from, int length) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDoubleArray.

Annotations
@Override
writeDoubleArrayAttributeback to summary
public void writeDoubleArrayAttribute(String prefix, String nsURI, String localName, double[] value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDoubleArrayAttribute.

Annotations
@Override
writeDoubleAttributeback to summary
public void writeDoubleAttribute(String prefix, String nsURI, String localName, double value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeDoubleAttribute.

Annotations
@Override
writeFloatback to summary
public void writeFloat(float value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeFloat.

Write a float value to the output as textual element content. The lexical representation of content is defined by the XML Schema float data type.

Annotations
@Override
writeFloatArrayback to summary
public void writeFloatArray(float[] value, int from, int length) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeFloatArray.

Annotations
@Override
writeFloatArrayAttributeback to summary
public void writeFloatArrayAttribute(String prefix, String nsURI, String localName, float[] value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeFloatArrayAttribute.

Annotations
@Override
writeFloatAttributeback to summary
public void writeFloatAttribute(String prefix, String nsURI, String localName, float value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeFloatAttribute.

Annotations
@Override
writeIntback to summary
public void writeInt(int value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeInt.

Write an int value to the output as textual element content. The lexical representation of content is defined by the XML Schema integer data type.

Annotations
@Override
writeIntArrayback to summary
public final void writeIntArray(int[] value, int from, int length) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntArray.

Write int array to the output. The lexical representation of a int array is defined by the following XML schema type:

   <xs:simpleType name="intArray">
      <xs:list itemType="xs:int"/>
   </xs:simpleType>
whose lexical space is a list of space-separated ints. This method can be called multiple times to write the array in chunks.
Parameters
value:int[]

The array from which to write the ints.

from:int

The index in the array from which writing starts.

length:int

The number of ints to write.

Annotations
@Override
writeIntArrayAttributeback to summary
public void writeIntArrayAttribute(String prefix, String nsURI, String localName, int[] value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntArrayAttribute.

Write int array attribute. The lexical representation of a int array is defined by the following XML schema type:

   <xs:simpleType name="intArray">
      <xs:list itemType="xs:int"/>
   </xs:simpleType>
whose lexical space is a list of space-separated ints.
Parameters
prefix:String

The attribute's prefix.

nsURI:String

The attribute's URI.

localName:String

The attribute's local name.

value:int[]

The array from which to write the ints.

Annotations
@Override
writeIntAttributeback to summary
public void writeIntAttribute(String prefix, String nsURI, String localName, int value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntAttribute.

Write an integer value to the output as attribute value. The lexical representation of content is defined by the XML Schema integer data type.

Parameters
prefix:String

The attribute's prefix. Null or "" if no prefix is to be used

nsURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:int

The integer value to write.

Annotations
@Override
writeIntegerback to summary
public void writeInteger(BigInteger value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeInteger.

Annotations
@Override
writeIntegerAttributeback to summary
public void writeIntegerAttribute(String prefix, String nsURI, String localName, BigInteger value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeIntegerAttribute.

Annotations
@Override
writeLongback to summary
public void writeLong(long value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLong.

Write a long value to the output as textual element content. The lexical representation of content is defined by the XML Schema long data type.

Annotations
@Override
writeLongArrayback to summary
public void writeLongArray(long[] value, int from, int length) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLongArray.

Annotations
@Override
writeLongArrayAttributeback to summary
public void writeLongArrayAttribute(String prefix, String nsURI, String localName, long[] value) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLongArrayAttribute.

Annotations
@Override
writeLongAttributeback to summary
public void writeLongAttribute(String prefix, String nsURI, String localName, long value) throws XMLStreamException

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

Doc from org.codehaus.stax2.typed.TypedXMLStreamWriter.writeLongAttribute.

Write an long value to the output as attribute value. The lexical representation of content is defined by the XML Schema long data type.

Parameters
prefix:String

The attribute's prefix. Null or "" if no prefix is to be used

nsURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:long

The long value to write.

Annotations
@Override
writeQNameback to summary
public void writeQName(QName name) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeQName.

Annotations
@Override
writeQNameAttributeback to summary
public void writeQNameAttribute(String prefix, String nsURI, String localName, QName name) throws XMLStreamException

Implements org.codehaus.stax2.typed.TypedXMLStreamWriter.writeQNameAttribute.

Annotations
@Override
writeTypedAttributeback to summary
protected abstract void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException

Method that will write attribute with value that is known not to require additional escaping.

writeTypedElementback to summary
protected final void writeTypedElement(AsciiValueEncoder enc) throws XMLStreamException