Class CharXmlWriter
java.lang.Object
com.fasterxml.aalto.out.WNameFactory
com.fasterxml.aalto.out.XmlWriter
com.fasterxml.aalto.out.CharXmlWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WriterActual Writer to use for outputting buffered data as appropriate.protected char[]protected final intprotected intprotected final intThis is the threshold used to check what is considered a "small" write; small writes will be buffered until resulting size will be above the threshold.Fields inherited from class 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid_closeTarget(boolean doClose) voidconstructName(String localName) constructName(String prefix, String localName) final voidflush()intMethod 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 intprotected intverifyCDataContent(char[] c, int start, int end) protected intverifyCDataContent(String content) protected intverifyCommentContent(String content) protected final voidwriteAsEntity(int c) voidwriteAttribute(WName name, char[] value, int offset, int vlen) voidwriteAttribute(WName name, String value) Note: can throw XMLStreamException, if name checking is enabled, and name is invalid (name check has to be in this writer, not caller, since it depends not only on xml limitations, but also on encoding limitations)final voidwriteAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) intwriteCData(char[] cbuf, int offset, int len) intwriteCData(String data) final voidfinal voidvoidwriteCharacters(char[] cbuf, int offset, int len) voidwriteCharacters(String text) intwriteComment(String data) Method that will try to output the content as specified.final voidfinal voidvoidvoidOlder "legacy" output method for outputting DOCTYPE declaration.voidwriteEndTag(WName name) voidwriteEntityReference(WName name) protected final voidintvoidwriteRaw(char[] cbuf, int offset, int len) voidprotected voidwriteSegmentedCData(char[] c, int start, int len, int index) protected voidwriteSegmentedCData(String content, int index) protected voidwriteSegmentedComment(String content, int index) voidwriteSpace(char[] cbuf, int offset, int len) voidwriteSpace(String data) voidvoidvoidwriteStartTagStart(WName name) Note: can throw XMLStreamException, if name checking is enabled, and name is invalid (name check has to be in this writer, not caller, since it depends not only on xml limitations, but also on encoding limitations)voidwriteTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) voidwriteXmlDeclaration(String version, String encoding, String standalone) Methods inherited from class XmlWriter
close, enableXml11, getAbsOffset, getColumn, getRow, guessEncodingBitSize, reportFailedEscaping, reportInvalidChar, reportInvalidEmptyName, reportNwfContent, reportNwfContent, reportNwfName, reportNwfName, throwOutputError, throwOutputError
-
Field Details
-
mSmallWriteSize
protected final int mSmallWriteSizeThis is the threshold used to check what is considered a "small" write; small writes will be buffered until resulting size will be above the threshold. -
_out
Actual Writer to use for outputting buffered data as appropriate. During active usage, remains as the writer initially set; set to null when this writer is closed. -
_outputBuffer
protected char[] _outputBuffer -
_outputPtr
protected int _outputPtr -
_outputBufferLen
protected final int _outputBufferLen
-
-
Constructor Details
-
CharXmlWriter
-
-
Method Details
-
getOutputPtr
protected int getOutputPtr()- Specified by:
getOutputPtrin classXmlWriter
-
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.
-
constructName
- Specified by:
constructNamein classXmlWriter
-
constructName
- Specified by:
constructNamein classXmlWriter
-
_releaseBuffers
public void _releaseBuffers()- Overrides:
_releaseBuffersin classXmlWriter
-
_closeTarget
- Specified by:
_closeTargetin classXmlWriter- Throws:
IOException
-
flush
- Specified by:
flushin classXmlWriter- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classXmlWriter- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classXmlWriter- Throws:
IOException
-
writeCDataStart
- Throws:
IOException
-
writeCDataEnd
- Throws:
IOException
-
writeCommentStart
- Throws:
IOException
-
writeCommentEnd
- Throws:
IOException
-
writeCData
- Specified by:
writeCDatain classXmlWriter- Parameters:
data- Contents of the CDATA section to write out- Returns:
- -1 to indicate succesful write, or index of the problematic character in input (first ']' from "]]>" sequence, in non-fixing mode)
- Throws:
IOExceptionXMLStreamException
-
writeCData
- Specified by:
writeCDatain classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeCharacters
- Specified by:
writeCharactersin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeCharacters
public void writeCharacters(char[] cbuf, int offset, int len) throws IOException, XMLStreamException - Specified by:
writeCharactersin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeSpace
- Specified by:
writeSpacein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeSpace
- Specified by:
writeSpacein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeComment
Method that will try to output the content as specified. If the content passed in has embedded "--" in it, it will either add an intervening space between consequtive hyphens (if content fixing is enabled), or return the offset of the first hyphen in multi-hyphen sequence.- Specified by:
writeCommentin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeDTD
Description copied from class:XmlWriterOlder "legacy" output method for outputting DOCTYPE declaration. Assumes that the passed-in String contains a complete DOCTYPE declaration properly quoted.- Specified by:
writeDTDin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeDTD
public void writeDTD(WName rootName, String systemId, String publicId, String internalSubset) throws IOException, XMLStreamException - Specified by:
writeDTDin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeEntityReference
- Specified by:
writeEntityReferencein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeXmlDeclaration
public void writeXmlDeclaration(String version, String encoding, String standalone) throws IOException, XMLStreamException - Specified by:
writeXmlDeclarationin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writePI
- Specified by:
writePIin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeStartTagStart
Description copied from class:XmlWriterNote: can throw XMLStreamException, if name checking is enabled, and name is invalid (name check has to be in this writer, not caller, since it depends not only on xml limitations, but also on encoding limitations)
- Specified by:
writeStartTagStartin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeStartTagEnd
- Specified by:
writeStartTagEndin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeStartTagEmptyEnd
- Specified by:
writeStartTagEmptyEndin classXmlWriter- Throws:
IOException
-
writeEndTag
- Specified by:
writeEndTagin classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeAttribute
Description copied from class:XmlWriterNote: can throw XMLStreamException, if name checking is enabled, and name is invalid (name check has to be in this writer, not caller, since it depends not only on xml limitations, but also on encoding limitations)
- Specified by:
writeAttributein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeAttribute
public void writeAttribute(WName name, char[] value, int offset, int vlen) throws IOException, XMLStreamException - Specified by:
writeAttributein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeTypedValue
public void writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws IOException, XMLStreamException - Specified by:
writeTypedValuein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeAttribute
public final void writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws IOException, XMLStreamException - Specified by:
writeAttributein classXmlWriter- Throws:
IOExceptionXMLStreamException
-
writeName
- Throws:
IOException
-
verifyCDataContent
- Returns:
- Index at which a problem was found, if any; -1 if there's no problem.
-
verifyCDataContent
protected int verifyCDataContent(char[] c, int start, int end) -
verifyCommentContent
-
writeSegmentedCData
- Throws:
IOException
-
writeSegmentedCData
- Throws:
IOException
-
writeSegmentedComment
- Throws:
IOException
-
writeAsEntity
- Throws:
IOException
-