Implementation Notes
Parts of surrogate handling are implemented here in the base class:
storage for the first part of a split surrogate (only possible when
character content is output split in multiple calls) is within
base class. Also, simple checks for unmatched surrogate pairs are
in writeAscii method, since it is the most convenient
place to catch cases where a text segment ends with an unmatched
surrogate pair half.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final byte | |
| pack-priv static final int | DEFAULT_BUFFER_SIZE
Let's use a typical default to have a compromise between large enough chunks to output, and minimizing memory overhead. |
| private final OutputStream | mOut
Actual output stream to use for outputting encoded content as bytes. |
| protected byte[] | |
| protected int | |
| protected int | mSurrogate
In case a split surrogate pair is output (which can only successfully
occur with either |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected final int | |
| public void | close(boolean forceRealClose)
Implements abstract com. Method called to flush the buffer(s), and close the output sink (stream or writer) if enabled (auto-closing) or forced. |
| public final void | |
| protected final void | |
| protected int | getOutputPtr()
Implements abstract com. This method is needed by the super class, to calculate hard byte/char offsets. |
| protected final OutputStream | |
| protected final Writer | |
| protected final void | |
| protected final void | |
| protected final void | |
| protected final void | |
| protected final void | |
| protected final int | Returns: New value ofmOutputPtrEntity writing can be optimized quite nicely, since it only needs to output ascii characters. |
| public void | writeAttribute(String localName, String value)
Implements abstract com. 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) |
| public void | writeAttribute(String localName, char[] value, int offset, int len)
Implements abstract com.
|
| public void | writeAttribute(String prefix, String localName, String value)
Implements abstract com. 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) |
| public void | writeAttribute(String prefix, String localName, char[] value, int offset, int len)
Implements abstract com.
|
| protected abstract void | |
| protected abstract void | |
| public int | writeCData(String
Contents of the CDATA section to write out data)Implements abstract com.
|
| public int | writeCData(char[] cbuf, int offset, int len)
Implements abstract com.
|
| protected abstract int | |
| protected abstract int | |
| public final void | |
| public final void | |
| public final void | |
| public final void | writeCharacters(char[] cbuf, int offset, int len)
Implements abstract com.
|
| public int | writeComment(String data)
Implements abstract com. Method that will try to output the content as specified. |
| protected abstract int | |
| public final void | |
| public final void | |
| public void | writeDTD(String data)
Implements abstract com. Older "legacy" output method for outputting DOCTYPE declaration. |
| public void | |
| public void | |
| public void | writeEndTag(String prefix, String localName)
Implements abstract com.
|
| public void | writeEntityReference(String name)
Implements abstract com.
|
| protected final void | |
| protected final void | |
| public int | |
| protected abstract int | |
| public final void | |
| public final void | writePIStart(String target, boolean addSpace)
Implements abstract com.
|
| public abstract void | |
| public abstract void | |
| public final void | writeRawAscii(char[] buf, int offset, int len)
Implements abstract com. Like |
| public void | |
| public void | |
| public void | writeStartTagStart(String localName)
Implements abstract com. 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) |
| public void | writeStartTagStart(String prefix, String localName)
Implements abstract com. 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 abstract void | |
| protected abstract void | |
| public void | writeTypedAttribute(String localName, AsciiValueEncoder enc)
Implements abstract com. Method similar to |
| public void | writeTypedAttribute(String prefix, String localName, AsciiValueEncoder enc)
Implements abstract com. Method similar to |
| public void | writeTypedAttribute(String prefix, String localName, String nsURI, AsciiValueEncoder enc, XMLValidator validator, char[] copyBuffer)
Implements abstract com. Method similar to |
| public final void | writeTypedElement(AsciiValueEncoder
Encoder that will produce content enc)Implements abstract com. Non-validating version of typed write method |
| public final void | writeTypedElement(AsciiValueEncoder
Encoder that will produce content enc, XMLValidator Validator to use for validating serialized textual
content (can not be null) validator, char[] Temporary buffer that writer can use for temporary
copies as necessary copyBuffer)Implements abstract com. Validating version of typed write method |
| public void | writeXmlDeclaration(String version, String encoding, String standalone)
Implements abstract com.
|
| BYTE_A | back to summary |
|---|---|
| pack-priv static final byte BYTE_A | |
| BYTE_AMP | back to summary |
|---|---|
| pack-priv static final byte BYTE_AMP | |
| BYTE_APOS | back to summary |
|---|---|
| pack-priv static final byte BYTE_APOS | |
| BYTE_COLON | back to summary |
|---|---|
| pack-priv static final byte BYTE_COLON | |
| BYTE_EQ | back to summary |
|---|---|
| pack-priv static final byte BYTE_EQ | |
| BYTE_G | back to summary |
|---|---|
| pack-priv static final byte BYTE_G | |
| BYTE_GT | back to summary |
|---|---|
| pack-priv static final byte BYTE_GT | |
| BYTE_HASH | back to summary |
|---|---|
| pack-priv static final byte BYTE_HASH | |
| BYTE_HYPHEN | back to summary |
|---|---|
| pack-priv static final byte BYTE_HYPHEN | |
| BYTE_L | back to summary |
|---|---|
| pack-priv static final byte BYTE_L | |
| BYTE_LBRACKET | back to summary |
|---|---|
| pack-priv static final byte BYTE_LBRACKET | |
| BYTE_LT | back to summary |
|---|---|
| pack-priv static final byte BYTE_LT | |
| BYTE_M | back to summary |
|---|---|
| pack-priv static final byte BYTE_M | |
| BYTE_O | back to summary |
|---|---|
| pack-priv static final byte BYTE_O | |
| BYTE_P | back to summary |
|---|---|
| pack-priv static final byte BYTE_P | |
| BYTE_Q | back to summary |
|---|---|
| pack-priv static final byte BYTE_Q | |
| BYTE_QMARK | back to summary |
|---|---|
| pack-priv static final byte BYTE_QMARK | |
| BYTE_QUOT | back to summary |
|---|---|
| pack-priv static final byte BYTE_QUOT | |
| BYTE_RBRACKET | back to summary |
|---|---|
| pack-priv static final byte BYTE_RBRACKET | |
| BYTE_S | back to summary |
|---|---|
| pack-priv static final byte BYTE_S | |
| BYTE_SEMICOLON | back to summary |
|---|---|
| pack-priv static final byte BYTE_SEMICOLON | |
| BYTE_SLASH | back to summary |
|---|---|
| pack-priv static final byte BYTE_SLASH | |
| BYTE_SPACE | back to summary |
|---|---|
| pack-priv static final byte BYTE_SPACE | |
| BYTE_T | back to summary |
|---|---|
| pack-priv static final byte BYTE_T | |
| BYTE_U | back to summary |
|---|---|
| pack-priv static final byte BYTE_U | |
| BYTE_X | back to summary |
|---|---|
| pack-priv static final byte BYTE_X | |
| DEFAULT_BUFFER_SIZE | back to summary |
|---|---|
| pack-priv static final int DEFAULT_BUFFER_SIZE Let's use a typical default to have a compromise between large enough chunks to output, and minimizing memory overhead. 4k should be close enough to a physical page to work out acceptably, without causing excessive (if temporary) memory usage. | |
| mOut | back to summary |
|---|---|
| private final OutputStream mOut Actual output stream to use for outputting encoded content as bytes. | |
| mOutputBuffer | back to summary |
|---|---|
| protected byte[] mOutputBuffer | |
| mOutputPtr | back to summary |
|---|---|
| protected int mOutputPtr | |
| mSurrogate | back to summary |
|---|---|
| protected int mSurrogate In case a split surrogate pair is output (which can only successfully
occur with either | |
| EncodingXmlWriter | back to summary |
|---|---|
| public EncodingXmlWriter(OutputStream out, WriterConfig cfg, String encoding, boolean autoclose) throws IOException | |
| calcSurrogate | back to summary |
|---|---|
| protected final int calcSurrogate(int secondSurr) throws IOException | |
| close | back to summary |
|---|---|
| public void close(boolean forceRealClose) throws IOException Implements abstract com. Doc from com. Method called to flush the buffer(s), and close the output sink (stream or writer) if enabled (auto-closing) or forced.
| |
| flush | back to summary |
|---|---|
| public final void flush() throws IOException Implements abstract com.
| |
| flushBuffer | back to summary |
|---|---|
| protected final void flushBuffer() throws IOException | |
| getOutputPtr | back to summary |
|---|---|
| protected int getOutputPtr() Implements abstract com. This method is needed by the super class, to calculate hard byte/char offsets.
| |
| getOutputStream | back to summary |
|---|---|
| protected final OutputStream getOutputStream() Implements abstract com.
| |
| getWriter | back to summary |
|---|---|
| protected final Writer getWriter() Implements abstract com.
| |
| throwUnpairedSurrogate | back to summary |
|---|---|
| protected final void throwUnpairedSurrogate() throws IOException | |
| throwUnpairedSurrogate | back to summary |
|---|---|
| protected final void throwUnpairedSurrogate(int code) throws IOException | |
| writeAscii | back to summary |
|---|---|
| protected final void writeAscii(byte b) throws IOException | |
| writeAscii | back to summary |
|---|---|
| protected final void writeAscii(byte b1, byte b2) throws IOException | |
| writeAscii | back to summary |
|---|---|
| protected final void writeAscii(String str) throws IOException | |
| writeAsEntity | back to summary |
|---|---|
| protected final int writeAsEntity(int c) throws IOException Entity writing can be optimized quite nicely, since it only needs to output ascii characters.
| |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String localName, String value) throws IOException, XMLStreamException Implements abstract com. Doc from com. 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 | back to summary |
|---|---|
| public void writeAttribute(String localName, char[] value, int offset, int len) throws IOException, XMLStreamException Implements abstract com.
| |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String prefix, String localName, String value) throws IOException, XMLStreamException Implements abstract com. Doc from com. 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 | back to summary |
|---|---|
| public void writeAttribute(String prefix, String localName, char[] value, int offset, int len) throws IOException, XMLStreamException Implements abstract com.
| |
| writeAttrValue | back to summary |
|---|---|
| protected abstract void writeAttrValue(String data) throws IOException | |
| writeAttrValue | back to summary |
|---|---|
| protected abstract void writeAttrValue(char[] value, int offset, int len) throws IOException | |
| writeCData | back to summary |
|---|---|
| public int writeCData(String data) throws IOException Implements abstract com.
| |
| writeCData | back to summary |
|---|---|
| public int writeCData(char[] cbuf, int offset, int len) throws IOException Implements abstract com.
| |
| writeCDataContent | back to summary |
|---|---|
| protected abstract int writeCDataContent(String data) throws IOException | |
| writeCDataContent | back to summary |
|---|---|
| protected abstract int writeCDataContent(char[] cbuf, int start, int len) throws IOException | |
| writeCDataEnd | back to summary |
|---|---|
| public final void writeCDataEnd() throws IOException Implements abstract com.
| |
| writeCDataStart | back to summary |
|---|---|
| public final void writeCDataStart() throws IOException Implements abstract com.
| |
| writeCharacters | back to summary |
|---|---|
| public final void writeCharacters(String data) throws IOException Implements abstract com.
| |
| writeCharacters | back to summary |
|---|---|
| public final void writeCharacters(char[] cbuf, int offset, int len) throws IOException Implements abstract com.
| |
| writeComment | back to summary |
|---|---|
| public int writeComment(String data) throws IOException Implements abstract com. 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.
| |
| writeCommentContent | back to summary |
|---|---|
| protected abstract int writeCommentContent(String data) throws IOException | |
| writeCommentEnd | back to summary |
|---|---|
| public final void writeCommentEnd() throws IOException Implements abstract com.
| |
| writeCommentStart | back to summary |
|---|---|
| public final void writeCommentStart() throws IOException Implements abstract com.
| |
| writeDTD | back to summary |
|---|---|
| public void writeDTD(String data) throws IOException Implements abstract com. Doc from com. Older "legacy" output method for outputting DOCTYPE declaration. Assumes that the passed-in String contains a complete DOCTYPE declaration properly quoted.
| |
| writeDTD | back to summary |
|---|---|
| public void writeDTD(String rootName, String systemId, String publicId, String internalSubset) throws IOException, XMLStreamException Implements abstract com.
| |
| writeEndTag | back to summary |
|---|---|
| public void writeEndTag(String localName) throws IOException Implements abstract com.
| |
| writeEndTag | back to summary |
|---|---|
| public void writeEndTag(String prefix, String localName) throws IOException Implements abstract com.
| |
| writeEntityReference | back to summary |
|---|---|
| public void writeEntityReference(String name) throws IOException, XMLStreamException Implements abstract com.
| |
| writeName | back to summary |
|---|---|
| protected final void writeName(String name) throws IOException, XMLStreamException | |
| writeNameUnchecked | back to summary |
|---|---|
| protected final void writeNameUnchecked(String name) throws IOException | |
| writePI | back to summary |
|---|---|
| public int writePI(String target, String data) throws IOException, XMLStreamException Implements abstract com.
| |
| writePIData | back to summary |
|---|---|
| protected abstract int writePIData(String data) throws IOException, XMLStreamException | |
| writePIEnd | back to summary |
|---|---|
| public final void writePIEnd() throws IOException Implements abstract com.
| |
| writePIStart | back to summary |
|---|---|
| public final void writePIStart(String target, boolean addSpace) throws IOException Implements abstract com.
| |
| writeRaw | back to summary |
|---|---|
| public abstract void writeRaw(char[] cbuf, int offset, int len) throws IOException Implements abstract com.
| |
| writeRaw | back to summary |
|---|---|
| public abstract void writeRaw(String str, int offset, int len) throws IOException Implements abstract com.
| |
| writeRawAscii | back to summary |
|---|---|
| public final void writeRawAscii(char[] buf, int offset, int len) throws IOException Implements abstract com. Doc from com. Like
| |
| writeStartTagEmptyEnd | back to summary |
|---|---|
| public void writeStartTagEmptyEnd() throws IOException Implements abstract com.
| |
| writeStartTagEnd | back to summary |
|---|---|
| public void writeStartTagEnd() throws IOException Implements abstract com.
| |
| writeStartTagStart | back to summary |
|---|---|
| public void writeStartTagStart(String localName) throws IOException, XMLStreamException Implements abstract com. Doc from com. 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 | back to summary |
|---|---|
| public void writeStartTagStart(String prefix, String localName) throws IOException, XMLStreamException Implements abstract com. Doc from com. 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)
| |
| writeTextContent | back to summary |
|---|---|
| protected abstract void writeTextContent(String data) throws IOException | |
| writeTextContent | back to summary |
|---|---|
| protected abstract void writeTextContent(char[] cbuf, int start, int len) throws IOException | |
| writeTypedAttribute | back to summary |
|---|---|
| public void writeTypedAttribute(String localName, AsciiValueEncoder enc) throws IOException, XMLStreamException Implements abstract com. Doc from com. Method similar to
| |
| writeTypedAttribute | back to summary |
|---|---|
| public void writeTypedAttribute(String prefix, String localName, AsciiValueEncoder enc) throws IOException, XMLStreamException Implements abstract com. Doc from com. Method similar to
| |
| writeTypedAttribute | back to summary |
|---|---|
| public void writeTypedAttribute(String prefix, String localName, String nsURI, AsciiValueEncoder enc, XMLValidator validator, char[] copyBuffer) throws IOException, XMLStreamException Implements abstract com. Doc from com. Method similar to
| |
| writeTypedElement | back to summary |
|---|---|
| public final void writeTypedElement(AsciiValueEncoder enc) throws IOException Implements abstract com. Non-validating version of typed write method
| |
| writeTypedElement | back to summary |
|---|---|
| public final void writeTypedElement(AsciiValueEncoder enc, XMLValidator validator, char[] copyBuffer) throws IOException, XMLStreamException Implements abstract com. Validating version of typed write method
| |
| writeXmlDeclaration | back to summary |
|---|---|
| public void writeXmlDeclaration(String version, String encoding, String standalone) throws IOException Implements abstract com.
| |