Package com.fasterxml.aalto.out
Class Utf8XmlWriter
- java.lang.Object
-
- com.fasterxml.aalto.out.WNameFactory
-
- com.fasterxml.aalto.out.XmlWriter
-
- com.fasterxml.aalto.out.ByteXmlWriter
-
- com.fasterxml.aalto.out.Utf8XmlWriter
-
public final class Utf8XmlWriter extends ByteXmlWriter
This is the generic implementation ofXmlWriter, used if the destination is byte-basedOutputStream, and encoding is UTF-8.
-
-
Field Summary
-
Fields inherited from class com.fasterxml.aalto.out.ByteXmlWriter
_charTypes, _out, _outputBuffer, _outputBufferLen, _outputPtr, _surrogate, BYTE_A, BYTE_AMP, BYTE_APOS, BYTE_COLON, BYTE_EQ, BYTE_G, BYTE_GT, BYTE_HASH, BYTE_HYPHEN, BYTE_L, BYTE_LBRACKET, BYTE_LT, BYTE_M, BYTE_O, BYTE_P, BYTE_Q, BYTE_QMARK, BYTE_QUOT, BYTE_RBRACKET, BYTE_S, BYTE_SEMICOLON, BYTE_SLASH, BYTE_SPACE, BYTE_T, BYTE_U, BYTE_X, BYTES_CDATA_END, BYTES_CDATA_START, BYTES_COMMENT_END, BYTES_COMMENT_START, BYTES_XMLDECL_ENCODING, BYTES_XMLDECL_STANDALONE, BYTES_XMLDECL_START, DEFAULT_COPY_BUFFER_SIZE, DEFAULT_FULL_BUFFER_SIZE, SMALL_WRITE
-
Fields inherited from class com.fasterxml.aalto.out.XmlWriter
_cfgNsAware, _checkContent, _checkNames, _config, _copyBuffer, _copyBufferLen, _locPastChars, _locRowNr, _locRowStartOffset, _xml11, ATTR_MIN_ARRAYCOPY, DEFAULT_COPYBUFFER_LEN, MIN_ARRAYCOPY, SURR1_FIRST, SURR1_LAST, SURR2_FIRST, SURR2_LAST
-
-
Constructor Summary
Constructors Constructor Description Utf8XmlWriter(WriterConfig cfg, java.io.OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WNamedoConstructName(java.lang.String localName)protected WNamedoConstructName(java.lang.String prefix, java.lang.String localName)intgetHighestEncodable()Method called by error reporting code, to figure out if a given character is encodable (without using character entities) with the current encoding or not.protected voidoutput2ByteChar(int ch)protected intoutputMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen)Method called to output a character that is beyond range of 1- and 2-byte UTF-8 encodings.protected intoutputStrictMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen)Method called to output a character beyond basic 1- or 2-byte encoding (code 0x0800 and above), without being able to use character entitiesprotected voidoutputSurrogates(int surr1, int surr2)Method called to output a composite character, result of combining 2 surrogate characters.voidwriteRaw(char[] cbuf, int offset, int len)This method is heavily encoding-dependant, so it needs to be deferred to sub-classes-
Methods inherited from class com.fasterxml.aalto.out.ByteXmlWriter
_closeTarget, _releaseBuffers, calcSurrogate, constructName, constructName, fastWriteAttrValue, flush, flushBuffer, getAscii, getAscii, getAscii, getOutputPtr, throwUnpairedSurrogate, throwUnpairedSurrogate, verifyNameComponent, writeAsEntity, writeAttribute, writeAttribute, writeAttribute, writeAttrValue, writeCData, writeCData, writeCDataContents, writeCDataEnd, writeCDataStart, writeCharacters, writeCharacters, writeComment, writeCommentContents, writeCommentEnd, writeCommentStart, writeDTD, writeDTD, writeEndTag, writeEntityReference, writeLongAttribute, writeName, writeName, writeName, writePI, writePIData, writeRaw, writeRaw, writeRaw, writeRaw, writeRaw, writeSpace, writeSpace, writeStartTagEmptyEnd, writeStartTagEnd, writeStartTagStart, writeTypedValue, writeXmlDeclaration
-
Methods inherited from class com.fasterxml.aalto.out.XmlWriter
close, enableXml11, getAbsOffset, getColumn, getRow, guessEncodingBitSize, reportFailedEscaping, reportInvalidChar, reportInvalidEmptyName, reportNwfContent, reportNwfContent, reportNwfName, reportNwfName, throwOutputError, throwOutputError
-
-
-
-
Constructor Detail
-
Utf8XmlWriter
public Utf8XmlWriter(WriterConfig cfg, java.io.OutputStream out)
-
-
Method Detail
-
getHighestEncodable
public int getHighestEncodable()
Description copied from class:XmlWriterMethod called by error reporting code, to figure out if a given character is encodable (without using character entities) with the current encoding or not.- Specified by:
getHighestEncodablein classXmlWriter- Returns:
- Character code of the highest character that can be natively encoded.
-
writeRaw
public void writeRaw(char[] cbuf, int offset, int len) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionDescription copied from class:ByteXmlWriterThis method is heavily encoding-dependant, so it needs to be deferred to sub-classes- Specified by:
writeRawin classByteXmlWriter- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
doConstructName
protected WName doConstructName(java.lang.String localName) throws javax.xml.stream.XMLStreamException
- Specified by:
doConstructNamein classByteXmlWriter- Throws:
javax.xml.stream.XMLStreamException
-
doConstructName
protected WName doConstructName(java.lang.String prefix, java.lang.String localName) throws javax.xml.stream.XMLStreamException
- Specified by:
doConstructNamein classByteXmlWriter- Throws:
javax.xml.stream.XMLStreamException
-
outputSurrogates
protected final void outputSurrogates(int surr1, int surr2) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionDescription copied from class:ByteXmlWriterMethod called to output a composite character, result of combining 2 surrogate characters.- Specified by:
outputSurrogatesin classByteXmlWriter- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
output2ByteChar
protected final void output2ByteChar(int ch) throws java.io.IOException, javax.xml.stream.XMLStreamException- Specified by:
output2ByteCharin classByteXmlWriter- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
outputMultiByteChar
protected final int outputMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionMethod called to output a character that is beyond range of 1- and 2-byte UTF-8 encodings. This means it's either invalid character, or needs to be encoded using 3- or 4-byte encoding.- Specified by:
outputMultiByteCharin classByteXmlWriter- Parameters:
inputOffset- Input pointer after character has been handled; either same as one passed in, or one more if a surrogate character was succesfully handled- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
outputStrictMultiByteChar
protected final int outputStrictMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionDescription copied from class:ByteXmlWriterMethod called to output a character beyond basic 1- or 2-byte encoding (code 0x0800 and above), without being able to use character entities- Specified by:
outputStrictMultiByteCharin classByteXmlWriter- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
-