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, throwOutputError
protected 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 XmlWriter
public final WName constructName(String localName) throws XMLStreamException
constructName
in class XmlWriter
XMLStreamException
public WName constructName(String prefix, String localName) throws XMLStreamException
constructName
in class XmlWriter
XMLStreamException
protected abstract WName doConstructName(String localName) throws XMLStreamException
XMLStreamException
protected abstract WName doConstructName(String prefix, String localName) throws XMLStreamException
XMLStreamException
protected void verifyNameComponent(String part) throws XMLStreamException
IllegalArgumentException
- If name component contains
an invalid (non-name; or for the initial characters,
non-name-first) character.XMLStreamException
protected abstract void outputSurrogates(int surr1, int surr2) throws IOException, XMLStreamException
IOException
XMLStreamException
protected abstract void output2ByteChar(int ch) throws IOException, XMLStreamException
IOException
XMLStreamException
protected abstract int outputStrictMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen) throws IOException, XMLStreamException
IOException
XMLStreamException
protected abstract int outputMultiByteChar(int ch, char[] cbuf, int inputOffset, int inputLen) throws IOException, XMLStreamException
IOException
XMLStreamException
public void _releaseBuffers()
_releaseBuffers
in class XmlWriter
public void _closeTarget(boolean doClose) throws IOException
_closeTarget
in class XmlWriter
IOException
public final void flush() throws IOException
flush
in class XmlWriter
IOException
public final void writeRaw(String text, int offset, int len) throws IOException, XMLStreamException
writeRaw
in class XmlWriter
IOException
XMLStreamException
public abstract void writeRaw(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
writeRaw
in class XmlWriter
IOException
XMLStreamException
public final void writeStartTagStart(WName name) throws IOException, XMLStreamException
XmlWriter
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)
writeStartTagStart
in class XmlWriter
IOException
XMLStreamException
public final void writeStartTagEnd() throws IOException, XMLStreamException
writeStartTagEnd
in class XmlWriter
IOException
XMLStreamException
public void writeStartTagEmptyEnd() throws IOException
writeStartTagEmptyEnd
in class XmlWriter
IOException
public final void writeEndTag(WName name) throws IOException, XMLStreamException
writeEndTag
in class XmlWriter
IOException
XMLStreamException
public final void writeAttribute(WName name, String value) throws IOException, XMLStreamException
XmlWriter
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)
writeAttribute
in class XmlWriter
IOException
XMLStreamException
public final void writeAttribute(WName name, char[] vbuf, int offset, int vlen) throws IOException, XMLStreamException
writeAttribute
in class XmlWriter
IOException
XMLStreamException
protected final int fastWriteAttrValue(char[] vbuf, int offset, int len, byte[] bbuf, int ptr) throws IOException, XMLStreamException
IOException
XMLStreamException
protected final void writeAttrValue(char[] vbuf, int offset, int len) throws IOException, XMLStreamException
IOException
XMLStreamException
protected final void writeLongAttribute(WName name, String value, int vlen) throws IOException, XMLStreamException
IOException
XMLStreamException
protected final void writeName(WName name) throws IOException
IOException
protected final void writeName(byte preChar, WName name) throws IOException
IOException
protected final void writeName(WName name, byte postChar) throws IOException
IOException
public int writeCData(String data) throws IOException, XMLStreamException
writeCData
in class XmlWriter
data
- Contents of the CDATA section to write outIOException
XMLStreamException
public int writeCData(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
writeCData
in class XmlWriter
IOException
XMLStreamException
protected int writeCDataContents(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
IOException
XMLStreamException
public final void writeCharacters(String text) throws IOException, XMLStreamException
writeCharacters
in class XmlWriter
IOException
XMLStreamException
public final void writeCharacters(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
writeCharacters
in class XmlWriter
IOException
XMLStreamException
public void writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws IOException, XMLStreamException
writeTypedValue
in class XmlWriter
IOException
XMLStreamException
public final void writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc) throws IOException, XMLStreamException
writeAttribute
in class XmlWriter
IOException
XMLStreamException
public int writeComment(String data) throws IOException, XMLStreamException
writeComment
in class XmlWriter
IOException
XMLStreamException
protected int writeCommentContents(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
IOException
XMLStreamException
public void writeDTD(String data) throws IOException, XMLStreamException
XmlWriter
writeDTD
in class XmlWriter
IOException
XMLStreamException
public void writeDTD(WName rootName, String systemId, String publicId, String internalSubset) throws IOException, XMLStreamException
writeDTD
in class XmlWriter
IOException
XMLStreamException
protected int writePIData(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
IOException
XMLStreamException
public void writeEntityReference(WName name) throws IOException, XMLStreamException
writeEntityReference
in class XmlWriter
IOException
XMLStreamException
public int writePI(WName target, String data) throws IOException, XMLStreamException
writePI
in class XmlWriter
IOException
XMLStreamException
public final void writeSpace(String data) throws IOException, XMLStreamException
writeSpace
in class XmlWriter
IOException
XMLStreamException
public void writeSpace(char[] cbuf, int offset, int len) throws IOException, XMLStreamException
writeSpace
in class XmlWriter
IOException
XMLStreamException
public void writeXmlDeclaration(String version, String encoding, String standalone) throws IOException, XMLStreamException
writeXmlDeclaration
in class XmlWriter
IOException
XMLStreamException
protected final void writeCDataStart() throws IOException
IOException
protected final void writeCDataEnd() throws IOException
IOException
protected final void writeCommentStart() throws IOException
IOException
protected final void writeCommentEnd() throws IOException
IOException
protected final void writeRaw(byte b) throws IOException
IOException
protected final void writeRaw(byte b1, byte b2) throws IOException
IOException
protected final void writeRaw(byte[] buf) throws IOException
IOException
protected final void writeRaw(byte[] buf, int offset, int len) throws IOException
IOException
protected final void throwUnpairedSurrogate() throws IOException
IOException
protected final void throwUnpairedSurrogate(int code) throws IOException
IOException
protected final void flushBuffer() throws IOException
IOException
protected final void writeAsEntity(int c) throws IOException
IOException
protected final int calcSurrogate(int surr1, int surr2, String context) throws XMLStreamException
XMLStreamException
protected 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 © 2018 FasterXML. All rights reserved.