public abstract class ByteXmlWriter extends XmlWriter
XmlWriter)
is used if the destination is byte-based OutputStream.
Further, all existing implementations are for encodings that are 7-bit ascii compatible. This is important since this means that marker and separator characters are identical independent of actual encoding. This would not hold if support for encodings like EBCDIC were supported using this class.
| Modifier and Type | Field and Description |
|---|---|
protected XmlCharTypes |
_charTypes
Validation tables used for verifying validity (and need for quoting)
|
protected OutputStream |
_out
Actual Writer to use for outputting buffered data as appropriate.
|
protected byte[] |
_outputBuffer |
protected int |
_outputBufferLen |
protected int |
_outputPtr |
protected int |
_surrogate
In case a split surrogate pair is output (which can occur for only
some of the methods, possibly depending on encoding),
the first part is temporarily stored within this member variable.
|
_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| Modifier | Constructor and Description |
|---|---|
protected |
ByteXmlWriter(WriterConfig cfg,
OutputStream out,
XmlCharTypes charTypes) |
| Modifier and Type | Method and Description |
|---|---|
void |
_closeTarget(boolean doClose) |
void |
_releaseBuffers() |
protected int |
calcSurrogate(int surr1,
int surr2,
String context) |
WName |
constructName(String localName) |
WName |
constructName(String prefix,
String localName) |
protected abstract WName |
doConstructName(String localName) |
protected abstract WName |
doConstructName(String prefix,
String localName) |
protected int |
fastWriteAttrValue(char[] vbuf,
int offset,
int len,
byte[] bbuf,
int ptr)
Method called to copy given attribute value, when it's known that
it will completely fit in the output buffer without further checks
|
void |
flush() |
protected void |
flushBuffer() |
protected static byte[] |
getAscii(String str) |
protected static void |
getAscii(String str,
byte[] result) |
protected static void |
getAscii(String str,
byte[] result,
int offset) |
protected int |
getOutputPtr() |
protected abstract void |
output2ByteChar(int ch) |
protected abstract int |
outputMultiByteChar(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); possibly using character
entities, if necessary
|
protected abstract int |
outputStrictMultiByteChar(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 entities
|
protected abstract void |
outputSurrogates(int surr1,
int surr2)
Method called to output a composite character, result of
combining 2 surrogate characters.
|
protected void |
throwUnpairedSurrogate() |
protected void |
throwUnpairedSurrogate(int code) |
protected void |
verifyNameComponent(String part)
Method used to verify that a name component (prefix, local name)
is a legal as per xml 1.0 specification.
|
protected void |
writeAsEntity(int c) |
void |
writeAttribute(WName name,
org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) |
void |
writeAttribute(WName name,
char[] vbuf,
int offset,
int vlen) |
void |
writeAttribute(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)
|
protected void |
writeAttrValue(char[] vbuf,
int offset,
int len) |
int |
writeCData(char[] cbuf,
int offset,
int len) |
int |
writeCData(String data) |
protected int |
writeCDataContents(char[] cbuf,
int offset,
int len) |
protected void |
writeCDataEnd() |
protected void |
writeCDataStart() |
void |
writeCharacters(char[] cbuf,
int offset,
int len) |
void |
writeCharacters(String text) |
int |
writeComment(String data)
Method that will try to output the content as specified.
|
protected int |
writeCommentContents(char[] cbuf,
int offset,
int len)
Note: the only way to fix comment contents is to inject a space
to split up consequtive '--' (or '-' that ends a comment).
|
protected void |
writeCommentEnd() |
protected void |
writeCommentStart() |
void |
writeDTD(String data)
Older "legacy" output method for outputting DOCTYPE declaration.
|
void |
writeDTD(WName rootName,
String systemId,
String publicId,
String internalSubset) |
void |
writeEndTag(WName name) |
void |
writeEntityReference(WName name) |
protected void |
writeLongAttribute(WName name,
String value,
int vlen) |
protected void |
writeName(byte preChar,
WName name) |
protected void |
writeName(WName name) |
protected void |
writeName(WName name,
byte postChar) |
int |
writePI(WName target,
String data) |
protected int |
writePIData(char[] cbuf,
int offset,
int len) |
protected void |
writeRaw(byte b) |
protected void |
writeRaw(byte[] buf) |
protected void |
writeRaw(byte[] buf,
int offset,
int len) |
protected void |
writeRaw(byte b1,
byte b2) |
abstract void |
writeRaw(char[] cbuf,
int offset,
int len)
This method is heavily encoding-dependant, so it needs
to be deferred to sub-classes
|
void |
writeRaw(String text,
int offset,
int len) |
void |
writeSpace(char[] cbuf,
int offset,
int len) |
void |
writeSpace(String data) |
void |
writeStartTagEmptyEnd() |
void |
writeStartTagEnd() |
void |
writeStartTagStart(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)
|
void |
writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) |
void |
writeXmlDeclaration(String version,
String encoding,
String standalone) |
close, enableXml11, getAbsOffset, getColumn, getHighestEncodable, getRow, guessEncodingBitSize, reportFailedEscaping, reportInvalidChar, reportInvalidEmptyName, reportNwfContent, reportNwfContent, reportNwfName, reportNwfName, throwOutputError, throwOutputErrorprotected OutputStream _out
protected byte[] _outputBuffer
protected int _outputPtr
protected final int _outputBufferLen
protected int _surrogate
protected final XmlCharTypes _charTypes
protected ByteXmlWriter(WriterConfig cfg, OutputStream out, XmlCharTypes charTypes)
protected final int getOutputPtr()
getOutputPtr in class XmlWriterpublic final WName constructName(String localName) throws XMLStreamException
constructName in class XmlWriterXMLStreamExceptionpublic WName constructName(String prefix, String localName) throws XMLStreamException
constructName in class XmlWriterXMLStreamExceptionprotected abstract WName doConstructName(String localName) throws XMLStreamException
XMLStreamExceptionprotected abstract WName doConstructName(String prefix, String localName) throws XMLStreamException
XMLStreamExceptionprotected void verifyNameComponent(String part) throws XMLStreamException
IllegalArgumentException - If name component contains
an invalid (non-name; or for the initial characters,
non-name-first) character.XMLStreamExceptionprotected abstract void outputSurrogates(int surr1,
int surr2)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionprotected abstract void output2ByteChar(int ch)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionprotected abstract int outputStrictMultiByteChar(int ch,
char[] cbuf,
int inputOffset,
int inputLen)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionprotected abstract int outputMultiByteChar(int ch,
char[] cbuf,
int inputOffset,
int inputLen)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionpublic void _releaseBuffers()
_releaseBuffers in class XmlWriterpublic void _closeTarget(boolean doClose)
throws IOException
_closeTarget in class XmlWriterIOExceptionpublic final void flush()
throws IOException
flush in class XmlWriterIOExceptionpublic final void writeRaw(String text, int offset, int len) throws IOException, XMLStreamException
writeRaw in class XmlWriterIOExceptionXMLStreamExceptionpublic abstract void writeRaw(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
writeRaw in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeStartTagStart(WName name) throws IOException, XMLStreamException
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)
writeStartTagStart in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeStartTagEnd()
throws IOException,
XMLStreamException
writeStartTagEnd in class XmlWriterIOExceptionXMLStreamExceptionpublic void writeStartTagEmptyEnd()
throws IOException
writeStartTagEmptyEnd in class XmlWriterIOExceptionpublic final void writeEndTag(WName name) throws IOException, XMLStreamException
writeEndTag in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeAttribute(WName name, String value) throws IOException, XMLStreamException
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)
writeAttribute in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeAttribute(WName name, char[] vbuf, int offset, int vlen) throws IOException, XMLStreamException
writeAttribute in class XmlWriterIOExceptionXMLStreamExceptionprotected final int fastWriteAttrValue(char[] vbuf,
int offset,
int len,
byte[] bbuf,
int ptr)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionprotected final void writeAttrValue(char[] vbuf,
int offset,
int len)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionprotected final void writeLongAttribute(WName name, String value, int vlen) throws IOException, XMLStreamException
IOExceptionXMLStreamExceptionprotected final void writeName(WName name) throws IOException
IOExceptionprotected final void writeName(byte preChar,
WName name)
throws IOException
IOExceptionprotected final void writeName(WName name, byte postChar) throws IOException
IOExceptionpublic int writeCData(String data) throws IOException, XMLStreamException
writeCData in class XmlWriterdata - Contents of the CDATA section to write outIOExceptionXMLStreamExceptionpublic int writeCData(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
writeCData in class XmlWriterIOExceptionXMLStreamExceptionprotected int writeCDataContents(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionpublic final void writeCharacters(String text) throws IOException, XMLStreamException
writeCharacters in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeCharacters(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
writeCharacters in class XmlWriterIOExceptionXMLStreamExceptionpublic void writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
throws IOException,
XMLStreamException
writeTypedValue in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws IOException, XMLStreamException
writeAttribute in class XmlWriterIOExceptionXMLStreamExceptionpublic int writeComment(String data) throws IOException, XMLStreamException
writeComment in class XmlWriterIOExceptionXMLStreamExceptionprotected int writeCommentContents(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionpublic void writeDTD(String data) throws IOException, XMLStreamException
XmlWriterwriteDTD in class XmlWriterIOExceptionXMLStreamExceptionpublic void writeDTD(WName rootName, String systemId, String publicId, String internalSubset) throws IOException, XMLStreamException
writeDTD in class XmlWriterIOExceptionXMLStreamExceptionprotected int writePIData(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
IOExceptionXMLStreamExceptionpublic void writeEntityReference(WName name) throws IOException, XMLStreamException
writeEntityReference in class XmlWriterIOExceptionXMLStreamExceptionpublic int writePI(WName target, String data) throws IOException, XMLStreamException
writePI in class XmlWriterIOExceptionXMLStreamExceptionpublic final void writeSpace(String data) throws IOException, XMLStreamException
writeSpace in class XmlWriterIOExceptionXMLStreamExceptionpublic void writeSpace(char[] cbuf,
int offset,
int len)
throws IOException,
XMLStreamException
writeSpace in class XmlWriterIOExceptionXMLStreamExceptionpublic void writeXmlDeclaration(String version, String encoding, String standalone) throws IOException, XMLStreamException
writeXmlDeclaration in class XmlWriterIOExceptionXMLStreamExceptionprotected final void writeCDataStart()
throws IOException
IOExceptionprotected final void writeCDataEnd()
throws IOException
IOExceptionprotected final void writeCommentStart()
throws IOException
IOExceptionprotected final void writeCommentEnd()
throws IOException
IOExceptionprotected final void writeRaw(byte b)
throws IOException
IOExceptionprotected final void writeRaw(byte b1,
byte b2)
throws IOException
IOExceptionprotected final void writeRaw(byte[] buf)
throws IOException
IOExceptionprotected final void writeRaw(byte[] buf,
int offset,
int len)
throws IOException
IOExceptionprotected final void throwUnpairedSurrogate()
throws IOException
IOExceptionprotected final void throwUnpairedSurrogate(int code)
throws IOException
IOExceptionprotected final void flushBuffer()
throws IOException
IOExceptionprotected final void writeAsEntity(int c)
throws IOException
IOExceptionprotected final int calcSurrogate(int surr1,
int surr2,
String context)
throws XMLStreamException
XMLStreamExceptionprotected static final byte[] getAscii(String str)
protected static final void getAscii(String str, byte[] result)
protected static final void getAscii(String str, byte[] result, int offset)
Copyright © 2019 FasterXML. All rights reserved.