|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.fasterxml.aalto.out.WNameFactory
com.fasterxml.aalto.out.XmlWriter
com.fasterxml.aalto.out.ByteXmlWriter
public abstract class ByteXmlWriter
This abstract base class (partial implementation of 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.
| Field Summary | |
|---|---|
protected java.io.OutputStream |
_out
Actual Writer to use for outputting buffered data as appropriate. |
protected byte[] |
_outputBuffer
|
protected int |
_outputBufferLen
|
protected int |
_outputPtr
|
protected XmlCharTypes |
mCharTypes
Validation tables used for verifying validity (and need for quoting) |
protected char[] |
mCopyBuffer
Temporary copy buffer, in which character content from Strings can be copied to first (since String.getChars(char[], int) can be
drastically faster than String.charAt(int)!), to be converted |
protected int |
mCopyBufferLen
|
protected int |
mSurrogate
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. |
| Fields inherited from class com.fasterxml.aalto.out.XmlWriter |
|---|
ATTR_MIN_ARRAYCOPY, DEFAULT_COPYBUFFER_LEN, mCfgNsAware, mCheckContent, mCheckNames, MIN_ARRAYCOPY, mLocPastChars, mLocRowNr, mLocRowStartOffset, mXml11, SURR1_FIRST, SURR1_LAST, SURR2_FIRST, SURR2_LAST |
| Constructor Summary | |
|---|---|
protected |
ByteXmlWriter(WriterConfig cfg,
java.io.OutputStream out,
XmlCharTypes charTypes)
|
| Method Summary | |
|---|---|
void |
_closeTarget(boolean doClose)
|
void |
_releaseBuffers()
|
protected int |
calcSurrogate(int surr1,
int surr2,
java.lang.String context)
|
WName |
constructName(java.lang.String localName)
|
WName |
constructName(java.lang.String prefix,
java.lang.String localName)
|
protected abstract WName |
doConstructName(java.lang.String localName)
|
protected abstract WName |
doConstructName(java.lang.String prefix,
java.lang.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(java.lang.String str)
|
protected static void |
getAscii(java.lang.String str,
byte[] result)
|
protected static void |
getAscii(java.lang.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(java.lang.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,
java.lang.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(java.lang.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(java.lang.String text)
|
int |
writeComment(java.lang.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(java.lang.String data)
Older "legacy" output method for outputting DOCTYPE declaration. |
void |
writeDTD(WName rootName,
java.lang.String systemId,
java.lang.String publicId,
java.lang.String internalSubset)
|
void |
writeEndTag(WName name)
|
void |
writeEntityReference(WName name)
|
protected void |
writeLongAttribute(WName name,
java.lang.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,
java.lang.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(java.lang.String text,
int offset,
int len)
|
void |
writeSpace(char[] cbuf,
int offset,
int len)
|
void |
writeSpace(java.lang.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(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone)
|
| Methods inherited from class com.fasterxml.aalto.out.XmlWriter |
|---|
close, enableXml11, getAbsOffset, getColumn, getHighestEncodable, getRow, guessEncodingBitSize, reportFailedEscaping, reportInvalidChar, reportInvalidEmptyName, reportNwfContent, reportNwfContent, reportNwfName, reportNwfName, throwOutputError, throwOutputError |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.io.OutputStream _out
protected byte[] _outputBuffer
protected int _outputPtr
protected final int _outputBufferLen
protected int mSurrogate
protected char[] mCopyBuffer
String.getChars(char[], int) can be
drastically faster than String.charAt(int)!), to be converted
protected final int mCopyBufferLen
protected final XmlCharTypes mCharTypes
| Constructor Detail |
|---|
protected ByteXmlWriter(WriterConfig cfg,
java.io.OutputStream out,
XmlCharTypes charTypes)
| Method Detail |
|---|
protected final int getOutputPtr()
getOutputPtr in class XmlWriter
public final WName constructName(java.lang.String localName)
throws javax.xml.stream.XMLStreamException
constructName in class XmlWriterjavax.xml.stream.XMLStreamException
public WName constructName(java.lang.String prefix,
java.lang.String localName)
throws javax.xml.stream.XMLStreamException
constructName in class XmlWriterjavax.xml.stream.XMLStreamException
protected abstract WName doConstructName(java.lang.String localName)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected abstract WName doConstructName(java.lang.String prefix,
java.lang.String localName)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void verifyNameComponent(java.lang.String part)
throws javax.xml.stream.XMLStreamException
java.lang.IllegalArgumentException - If name component contains
an invalid (non-name; or for the initial characters,
non-name-first) character.
javax.xml.stream.XMLStreamException
protected abstract void outputSurrogates(int surr1,
int surr2)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected abstract void output2ByteChar(int ch)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected abstract int outputStrictMultiByteChar(int ch,
char[] cbuf,
int inputOffset,
int inputLen)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected abstract int outputMultiByteChar(int ch,
char[] cbuf,
int inputOffset,
int inputLen)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamExceptionpublic void _releaseBuffers()
_releaseBuffers in class XmlWriter
public void _closeTarget(boolean doClose)
throws java.io.IOException
_closeTarget in class XmlWriterjava.io.IOException
public final void flush()
throws java.io.IOException
flush in class XmlWriterjava.io.IOException
public final void writeRaw(java.lang.String text,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeRaw in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public abstract void writeRaw(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeRaw in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeStartTagStart(WName name)
throws java.io.IOException,
javax.xml.stream.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 XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeStartTagEnd()
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeStartTagEnd in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public void writeStartTagEmptyEnd()
throws java.io.IOException
writeStartTagEmptyEnd in class XmlWriterjava.io.IOException
public final void writeEndTag(WName name)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeEndTag in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeAttribute(WName name,
java.lang.String value)
throws java.io.IOException,
javax.xml.stream.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 XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeAttribute(WName name,
char[] vbuf,
int offset,
int vlen)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeAttribute in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
protected final int fastWriteAttrValue(char[] vbuf,
int offset,
int len,
byte[] bbuf,
int ptr)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected final void writeAttrValue(char[] vbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected final void writeLongAttribute(WName name,
java.lang.String value,
int vlen)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
protected final void writeName(WName name)
throws java.io.IOException
java.io.IOException
protected final void writeName(byte preChar,
WName name)
throws java.io.IOException
java.io.IOException
protected final void writeName(WName name,
byte postChar)
throws java.io.IOException
java.io.IOException
public int writeCData(java.lang.String data)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeCData in class XmlWriterdata - Contents of the CDATA section to write out
java.io.IOException
javax.xml.stream.XMLStreamException
public int writeCData(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeCData in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
protected int writeCDataContents(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
public final void writeCharacters(java.lang.String text)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeCharacters in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeCharacters(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeCharacters in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public void writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeTypedValue in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeAttribute(WName name,
org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeAttribute in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public int writeComment(java.lang.String data)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeComment in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
protected int writeCommentContents(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
public void writeDTD(java.lang.String data)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
XmlWriter
writeDTD in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public void writeDTD(WName rootName,
java.lang.String systemId,
java.lang.String publicId,
java.lang.String internalSubset)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeDTD in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
protected int writePIData(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException
public void writeEntityReference(WName name)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeEntityReference in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public int writePI(WName target,
java.lang.String data)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writePI in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public final void writeSpace(java.lang.String data)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeSpace in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public void writeSpace(char[] cbuf,
int offset,
int len)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeSpace in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
public void writeXmlDeclaration(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone)
throws java.io.IOException,
javax.xml.stream.XMLStreamException
writeXmlDeclaration in class XmlWriterjava.io.IOException
javax.xml.stream.XMLStreamException
protected final void writeCDataStart()
throws java.io.IOException
java.io.IOException
protected final void writeCDataEnd()
throws java.io.IOException
java.io.IOException
protected final void writeCommentStart()
throws java.io.IOException
java.io.IOException
protected final void writeCommentEnd()
throws java.io.IOException
java.io.IOException
protected final void writeRaw(byte b)
throws java.io.IOException
java.io.IOException
protected final void writeRaw(byte b1,
byte b2)
throws java.io.IOException
java.io.IOException
protected final void writeRaw(byte[] buf)
throws java.io.IOException
java.io.IOException
protected final void writeRaw(byte[] buf,
int offset,
int len)
throws java.io.IOException
java.io.IOException
protected final void throwUnpairedSurrogate()
throws java.io.IOException
java.io.IOException
protected final void throwUnpairedSurrogate(int code)
throws java.io.IOException
java.io.IOException
protected final void flushBuffer()
throws java.io.IOException
java.io.IOException
protected final void writeAsEntity(int c)
throws java.io.IOException
java.io.IOException
protected final int calcSurrogate(int surr1,
int surr2,
java.lang.String context)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected static final byte[] getAscii(java.lang.String str)
protected static final void getAscii(java.lang.String str,
byte[] result)
protected static final void getAscii(java.lang.String str,
byte[] result,
int offset)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||