Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fasterxml.aalto.out
Class CharXmlWriter

    java.lang.Object
      com.fasterxml.aalto.out.WNameFactory
          com.fasterxml.aalto.out.XmlWriter
              com.fasterxml.aalto.out.CharXmlWriter

    public final class CharXmlWriter

extends XmlWriter

This is the generic implementation of `XmlWriter`, used if the destination is a character based, like a `Writer`.

Field Summary
`protected Writer` | `_out` Actual Writer to use for outputting buffered data as appropriate.
`protected char[]` | `_outputBuffer`
`protected int` | `_outputBufferLen`
`protected int` | `_outputPtr`
`protected int` | `mSmallWriteSize` This 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 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
`CharXmlWriter(WriterConfig cfg, Writer out)`

Method Summary
`void` | `_closeTarget(boolean doClose)`
`void` | `_releaseBuffers()`
`WName` | `constructName(String localName)`
`WName` | `constructName(String prefix, String localName)`
`void` | `flush()`
`int` | `getHighestEncodable()` Method 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 int` | `getOutputPtr()`
`protected int` | `verifyCDataContent(char[] c, int start, int end)`
`protected int` | `verifyCDataContent(String content)`
`protected int` | `verifyCommentContent(String content)`
`protected void` | `writeAsEntity(int c)`
`void` | `writeAttribute(WName name, org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)`
`void` | `writeAttribute(WName name, char[] value, 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)
`int` | `writeCData(char[] cbuf, int offset, int len)`
`int` | `writeCData(String data)`
`void` | `writeCDataEnd()`
`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.
`void` | `writeCommentEnd()`
`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` | `writeName(WName name)`
`int` | `writePI(WName target, String data)`
`void` | `writeRaw(char[] cbuf, int offset, int len)`
`void` | `writeRaw(String str, int offset, int len)`
`protected void` | `writeSegmentedCData(char[] c, int start, int len, int index)`
`protected void` | `writeSegmentedCData(String content, int index)`
`protected void` | `writeSegmentedComment(String content, int index)`
`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)`

Methods inherited from class com.fasterxml.aalto.out.XmlWriter
`close, enableXml11, getAbsOffset, getColumn, 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

### mSmallWriteSize

    protected final int mSmallWriteSize

  This 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

    protected Writer _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 Detail

### CharXmlWriter

    public CharXmlWriter(WriterConfig cfg,
                         Writer out)

Method Detail

### getOutputPtr

    protected int getOutputPtr()

  Specified by:
    `getOutputPtr` in class `XmlWriter`

### getHighestEncodable

    public int getHighestEncodable()

  Description copied from class: `XmlWriter`
  Method 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:
    `getHighestEncodable` in class `XmlWriter`
  Returns:
    Character code of the highest character that can be natively encoded.

### constructName

    public WName constructName(String localName)

  Specified by:
    `constructName` in class `XmlWriter`

### constructName

    public WName constructName(String prefix,
                               String localName)

  Specified by:
    `constructName` in class `XmlWriter`

### _releaseBuffers

    public void _releaseBuffers()

  Overrides:
    `_releaseBuffers` in class `XmlWriter`

### _closeTarget

    public void _closeTarget(boolean doClose)
                      throws IOException

  Specified by:
    `_closeTarget` in class `XmlWriter`
  Throws:
    `IOException`

### flush

    public final void flush()
                     throws IOException

  Specified by:
    `flush` in class `XmlWriter`
  Throws:
    `IOException`

### writeRaw

    public void writeRaw(char[] cbuf,
                         int offset,
                         int len)
                  throws IOException

  Specified by:
    `writeRaw` in class `XmlWriter`
  Throws:
    `IOException`

### writeRaw

    public void writeRaw(String str,
                         int offset,
                         int len)
                  throws IOException

  Specified by:
    `writeRaw` in class `XmlWriter`
  Throws:
    `IOException`

### writeCDataStart

    public final void writeCDataStart()
                               throws IOException

  Throws:
    `IOException`

### writeCDataEnd

    public final void writeCDataEnd()
                             throws IOException

  Throws:
    `IOException`

### writeCommentStart

    public final void writeCommentStart()
                                 throws IOException

  Throws:
    `IOException`

### writeCommentEnd

    public final void writeCommentEnd()
                               throws IOException

  Throws:
    `IOException`

### writeCData

    public int writeCData(String data)
                   throws IOException,
                          XMLStreamException

  Specified by:
    `writeCData` in class `XmlWriter`
  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:
    `IOException`
    `XMLStreamException`

### writeCData

    public int writeCData(char[] cbuf,
                          int offset,
                          int len)
                   throws IOException,
                          XMLStreamException

  Specified by:
    `writeCData` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeCharacters

    public void writeCharacters(String text)
                         throws IOException,
                                XMLStreamException

  Specified by:
    `writeCharacters` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeCharacters

    public void writeCharacters(char[] cbuf,
                                int offset,
                                int len)
                         throws IOException,
                                XMLStreamException

  Specified by:
    `writeCharacters` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeSpace

    public void writeSpace(String data)
                    throws IOException,
                           XMLStreamException

  Specified by:
    `writeSpace` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeSpace

    public void writeSpace(char[] cbuf,
                           int offset,
                           int len)
                    throws IOException,
                           XMLStreamException

  Specified by:
    `writeSpace` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeComment

    public int writeComment(String data)
                     throws IOException,
                            XMLStreamException

  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:
    `writeComment` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeDTD

    public void writeDTD(String data)
                  throws IOException,
                         XMLStreamException

  Description copied from class: `XmlWriter`
  Older "legacy" output method for outputting DOCTYPE declaration. Assumes that the passed-in String contains a complete DOCTYPE declaration properly quoted.

  Specified by:
    `writeDTD` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeDTD

    public void writeDTD(WName rootName,
                         String systemId,
                         String publicId,
                         String internalSubset)
                  throws IOException,
                         XMLStreamException

  Specified by:
    `writeDTD` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeEntityReference

    public void writeEntityReference(WName name)
                              throws IOException,
                                     XMLStreamException

  Specified by:
    `writeEntityReference` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeXmlDeclaration

    public void writeXmlDeclaration(String version,
                                    String encoding,
                                    String standalone)
                             throws IOException,
                                    XMLStreamException

  Specified by:
    `writeXmlDeclaration` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writePI

    public int writePI(WName target,
                       String data)
                throws IOException,
                       XMLStreamException

  Specified by:
    `writePI` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeStartTagStart

    public void writeStartTagStart(WName name)
                            throws IOException,
                                   XMLStreamException

  Description copied from class: `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)

  Specified by:
    `writeStartTagStart` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeStartTagEnd

    public void writeStartTagEnd()
                          throws IOException,
                                 XMLStreamException

  Specified by:
    `writeStartTagEnd` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeStartTagEmptyEnd

    public void writeStartTagEmptyEnd()
                               throws IOException

  Specified by:
    `writeStartTagEmptyEnd` in class `XmlWriter`
  Throws:
    `IOException`

### writeEndTag

    public void writeEndTag(WName name)
                     throws IOException,
                            XMLStreamException

  Specified by:
    `writeEndTag` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeAttribute

    public void writeAttribute(WName name,
                               String value)
                        throws IOException,
                               XMLStreamException

  Description copied from class: `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)

  Specified by:
    `writeAttribute` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeAttribute

    public void writeAttribute(WName name,
                               char[] value,
                               int offset,
                               int vlen)
                        throws IOException,
                               XMLStreamException

  Specified by:
    `writeAttribute` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeTypedValue

    public void writeTypedValue(org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
                         throws IOException,
                                XMLStreamException

  Specified by:
    `writeTypedValue` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeAttribute

    public final void writeAttribute(WName name,
                                     org.codehaus.stax2.ri.typed.AsciiValueEncoder enc)
                              throws IOException,
                                     XMLStreamException

  Specified by:
    `writeAttribute` in class `XmlWriter`
  Throws:
    `IOException`
    `XMLStreamException`

### writeName

    protected final void writeName(WName name)
                            throws IOException

  Throws:
    `IOException`

### verifyCDataContent

    protected int verifyCDataContent(String content)

  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

    protected int verifyCommentContent(String content)

### writeSegmentedCData

    protected void writeSegmentedCData(String content,
                                       int index)
                                throws IOException

  Throws:
    `IOException`

### writeSegmentedCData

    protected void writeSegmentedCData(char[] c,
                                       int start,
                                       int len,
                                       int index)
                                throws IOException

  Throws:
    `IOException`

### writeSegmentedComment

    protected void writeSegmentedComment(String content,
                                         int index)
                                  throws IOException

  Throws:
    `IOException`

### writeAsEntity

    protected final void writeAsEntity(int c)
                                throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011 Fasterxml.com. All Rights Reserved.