Javolution 6.0.0 java
javolution.xml.internal.stream.XMLStreamWriterImpl Class Reference
Inheritance diagram for javolution.xml.internal.stream.XMLStreamWriterImpl:
[legend]
Collaboration diagram for javolution.xml.internal.stream.XMLStreamWriterImpl:
[legend]

Public Member Functions

 XMLStreamWriterImpl ()
 
void setOutput (OutputStream out) throws XMLStreamException
 
void setOutput (OutputStream out, String encoding) throws XMLStreamException
 
void setOutput (Writer writer) throws XMLStreamException
 
void setRepairingNamespaces (boolean isRepairingNamespaces)
 
void setRepairingPrefix (String repairingPrefix)
 
void setIndentation (String indentation)
 
void setLineSeparator (String lineSeparator)
 
void setAutomaticEmptyElements (boolean automaticEmptyElements)
 
void setNoEmptyElementTag (boolean noEmptyElementTag)
 
void reset ()
 
void writeStartElement (CharSequence localName) throws XMLStreamException
 
void writeStartElement (CharSequence namespaceURI, CharSequence localName) throws XMLStreamException
 
void writeStartElement (CharSequence prefix, CharSequence localName, CharSequence namespaceURI) throws XMLStreamException
 
void writeEmptyElement (CharSequence localName) throws XMLStreamException
 
void writeEmptyElement (CharSequence namespaceURI, CharSequence localName) throws XMLStreamException
 
void writeEmptyElement (CharSequence prefix, CharSequence localName, CharSequence namespaceURI) throws XMLStreamException
 
void writeEndElement () throws XMLStreamException
 
void writeEndDocument () throws XMLStreamException
 
void close () throws XMLStreamException
 
void flush () throws XMLStreamException
 
void writeAttribute (CharSequence localName, CharSequence value) throws XMLStreamException
 
void writeAttribute (CharSequence namespaceURI, CharSequence localName, CharSequence value) throws XMLStreamException
 
void writeAttribute (CharSequence prefix, CharSequence namespaceURI, CharSequence localName, CharSequence value) throws XMLStreamException
 
void writeNamespace (CharSequence prefix, CharSequence namespaceURI) throws XMLStreamException
 
void writeDefaultNamespace (CharSequence namespaceURI) throws XMLStreamException
 
void writeComment (CharSequence data) throws XMLStreamException
 
void writeProcessingInstruction (CharSequence target) throws XMLStreamException
 
void writeProcessingInstruction (CharSequence target, CharSequence data) throws XMLStreamException
 
void writeCData (CharSequence data) throws XMLStreamException
 
void writeDTD (CharSequence dtd) throws XMLStreamException
 
void writeEntityRef (CharSequence name) throws XMLStreamException
 
void writeStartDocument () throws XMLStreamException
 
void writeStartDocument (CharSequence version) throws XMLStreamException
 
void writeStartDocument (CharSequence encoding, CharSequence version) throws XMLStreamException
 
void writeCharacters (CharSequence text) throws XMLStreamException
 
void writeCharacters (char[] text, int start, int length) throws XMLStreamException
 
CharSequence getPrefix (CharSequence uri) throws XMLStreamException
 
void setPrefix (CharSequence prefix, CharSequence uri) throws XMLStreamException
 
void setDefaultNamespace (CharSequence uri) throws XMLStreamException
 
Object getProperty (String name) throws IllegalArgumentException
 

Package Functions

 XMLStreamWriterImpl (XMLOutputFactoryImpl factory)
 

Private Member Functions

void writeNewElement (CharSequence prefix, CharSequence localName, CharSequence namespaceURI) throws XMLStreamException
 
void writeAttributeOrNamespace (CharSequence prefix, CharSequence namespaceURI, CharSequence localName, CharSequence value) throws XMLStreamException
 
void closeOpenTag () throws XMLStreamException
 
void writeNamespaces () throws XMLStreamException
 
CharSequence getRepairedPrefix (CharSequence prefix, CharSequence namespaceURI) throws XMLStreamException
 
void resizeElemStack ()
 
final void writeNoEscape (String str) throws XMLStreamException
 
final void writeNoEscape (TextBuilder tb) throws XMLStreamException
 
final void writeNoEscape (CharSequence csq) throws XMLStreamException
 
final void writeEscape (CharSequence csq) throws XMLStreamException
 
final void write (Object csq, int start, int length, boolean escapeMarkup) throws XMLStreamException
 
final void writeDirectEscapedCharacters (char[] chars, int start, int end) throws XMLStreamException
 
boolean isEscaped (char c)
 
final void write (char c) throws XMLStreamException
 
void flushBuffer () throws XMLStreamException
 

Static Private Member Functions

static void getChars (CharSequence csq, int start, int end, char dest[], int destPos)
 

Private Attributes

int _nesting = 0
 
TextBuilder[] _qNames = new TextBuilder[16]
 
boolean _isElementOpen
 
boolean _isEmptyElement
 
final char[] _buffer = new char[BUFFER_LENGTH]
 
final NamespacesImpl _namespaces = new NamespacesImpl()
 
int _index
 
boolean _isRepairingNamespaces
 
String _repairingPrefix = "ns"
 
String _indentation
 
String _lineSeparator = "\n"
 
int _indentationLevel
 
boolean _automaticEmptyElements
 
boolean _noEmptyElementTag
 
int _autoNSCount
 
boolean _isAttributeValue
 
Writer _writer
 
String _encoding
 
final UTF8StreamWriter _utf8StreamWriter = new UTF8StreamWriter()
 
final XMLOutputFactoryImpl _factory
 
final CharArray _noChar = new CharArray("")
 
final CharArray _tmpCharArray = new CharArray()
 
final TextBuilder _autoPrefix = new TextBuilder()
 

Static Private Attributes

static final int BUFFER_LENGTH = 2048
 

Detailed Description

This class represents an implementation of XMLStreamWriter.

The writeCharacters methods will escape & , < and >. For attribute values, the writeAttribute methods will escape the above characters plus " and control characters.

Author
Jean-Marie Dautelle
Version
4.0, September 4, 2006

Definition at line 36 of file XMLStreamWriterImpl.java.

Constructor & Destructor Documentation

◆ XMLStreamWriterImpl() [1/2]

javolution.xml.internal.stream.XMLStreamWriterImpl.XMLStreamWriterImpl ( )

Default constructor.

Definition at line 150 of file XMLStreamWriterImpl.java.

150  {
151  this(null);
152  }

◆ XMLStreamWriterImpl() [2/2]

javolution.xml.internal.stream.XMLStreamWriterImpl.XMLStreamWriterImpl ( XMLOutputFactoryImpl  factory)
package

Factory-based constructor.

Definition at line 157 of file XMLStreamWriterImpl.java.

157  {
158  _factory = factory;
159  for (int i = 0; i < _qNames.length;) {
160  _qNames[i++] = new TextBuilder();
161  }
162  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._factory, javolution.xml.internal.stream.XMLStreamWriterImpl._qNames, and javolution.text.TextBuilder.length().

Here is the call graph for this function:

Member Function Documentation

◆ close()

void javolution.xml.internal.stream.XMLStreamWriterImpl.close ( ) throws XMLStreamException

Close this writer and free any resources associated with the writer. This must not close the underlying output stream.

Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 397 of file XMLStreamWriterImpl.java.

397  {
398  if (_writer != null) {
399  if (_nesting != 0) { // Closes all elements.
401  }
402  flush();
403  }
404  reset(); // Explicit reset.
405  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl._writer, javolution.xml.internal.stream.XMLStreamWriterImpl.flush(), javolution.xml.internal.stream.XMLStreamWriterImpl.reset(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument().

Here is the call graph for this function:

◆ closeOpenTag()

void javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag ( ) throws XMLStreamException
private

Definition at line 708 of file XMLStreamWriterImpl.java.

708  {
709 
710  // Writes namespaces now.
711  writeNamespaces();
712 
713  // Closes the tag.
714  _isElementOpen = false;
715  if (_isEmptyElement) {
716  if (_noEmptyElementTag) {
717  write('<');
718  write('/');
720  write('>');
721  } else { // Use empty element tag.
722  write('/');
723  write('>');
724  }
725  _nesting--;
726  _namespaces.pop();
727  _isEmptyElement = false;
728  } else {
729  write('>');
730  }
731  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLStreamWriterImpl._qNames, javolution.xml.internal.stream.NamespacesImpl.pop(), javolution.xml.internal.stream.XMLStreamWriterImpl.write(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespaces(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeCData(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeComment(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndElement(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeProcessingInstruction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

void javolution.xml.internal.stream.XMLStreamWriterImpl.flush ( ) throws XMLStreamException

Write any cached data to the underlying output mechanism.

Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 408 of file XMLStreamWriterImpl.java.

408  {
409  flushBuffer();
410  try {
411  _writer.flush();
412  } catch (IOException e) {
413  throw new XMLStreamException(e);
414  }
415  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._writer, and javolution.xml.internal.stream.XMLStreamWriterImpl.flushBuffer().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.close(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flushBuffer()

void javolution.xml.internal.stream.XMLStreamWriterImpl.flushBuffer ( ) throws XMLStreamException
private

Definition at line 929 of file XMLStreamWriterImpl.java.

929  {
930  try {
931  _writer.write(_buffer, 0, _index);
932  } catch (IOException e) {
933  throw new XMLStreamException(e);
934  } finally {
935  _index = 0;
936  }
937  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._buffer, javolution.xml.internal.stream.XMLStreamWriterImpl._index, and javolution.xml.internal.stream.XMLStreamWriterImpl._writer.

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.flush(), and javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Here is the caller graph for this function:

◆ getChars()

static void javolution.xml.internal.stream.XMLStreamWriterImpl.getChars ( CharSequence  csq,
int  start,
int  end,
char  dest[],
int  destPos 
)
staticprivate

Definition at line 861 of file XMLStreamWriterImpl.java.

862  {
863  for (int i = start, j = destPos; i < end;) {
864  dest[j++] = csq.charAt(i++);
865  }
866  }

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Here is the caller graph for this function:

◆ getPrefix()

CharSequence javolution.xml.internal.stream.XMLStreamWriterImpl.getPrefix ( CharSequence  uri) throws XMLStreamException

Gets the prefix the specified uri is bound to.

@param uri namespace URI
Returns
the prefix for the URI or null
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 592 of file XMLStreamWriterImpl.java.

592  {
593  return _namespaces.getPrefix(uri);
594  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, and javolution.xml.internal.stream.NamespacesImpl.getPrefix().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProperty()

Object javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty ( String  name) throws IllegalArgumentException

Gets the value of a feature/property from the underlying implementation.

Parameters
namethe name of the property.
Returns
the value of the property.
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 609 of file XMLStreamWriterImpl.java.

609  {
610  if (name.equals(XMLOutputFactory.IS_REPAIRING_NAMESPACES)) {
611  return new Boolean(_isRepairingNamespaces);
612  } else if (name.equals(XMLOutputFactory.REPAIRING_PREFIX)) {
613  return _repairingPrefix;
614  } else if (name.equals(XMLOutputFactory.AUTOMATIC_EMPTY_ELEMENTS)) {
615  return new Boolean(_automaticEmptyElements);
616  } else if (name.equals(XMLOutputFactory.NO_EMPTY_ELEMENT_TAG)) {
617  return new Boolean(_noEmptyElementTag);
618  } else if (name.equals(XMLOutputFactory.INDENTATION)) {
619  return _indentation;
620  } else if (name.equals(XMLOutputFactory.LINE_SEPARATOR)) {
621  return _lineSeparator;
622  } else {
623  throw new IllegalArgumentException("Property: " + name
624  + " not supported");
625  }
626  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLStreamWriterImpl._indentation, javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._lineSeparator, javolution.xml.internal.stream.XMLStreamWriterImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLStreamWriterImpl._repairingPrefix, javolution.xml.stream.XMLOutputFactory.AUTOMATIC_EMPTY_ELEMENTS, javolution.xml.stream.XMLOutputFactory.INDENTATION, javolution.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES, javolution.xml.stream.XMLOutputFactory.LINE_SEPARATOR, javolution.xml.stream.XMLOutputFactory.NO_EMPTY_ELEMENT_TAG, and javolution.xml.stream.XMLOutputFactory.REPAIRING_PREFIX.

◆ getRepairedPrefix()

CharSequence javolution.xml.internal.stream.XMLStreamWriterImpl.getRepairedPrefix ( CharSequence  prefix,
CharSequence  namespaceURI 
) throws XMLStreamException
private

Definition at line 766 of file XMLStreamWriterImpl.java.

767  {
768  CharArray prefixForURI = _namespaces.getPrefix(namespaceURI);
769  if ((prefixForURI != null)
770  && ((prefix == null) || prefixForURI.equals(prefix)))
771  return prefixForURI; // No repair needed.
772  if ((prefix == null) || (prefix.length() == 0)) { // Creates new prefix.
774  .append(_autoNSCount++);
775  }
776  _namespaces.setPrefix(prefix, namespaceURI, true); // Map to namespace URI.
777  return prefix;
778  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._autoNSCount, javolution.xml.internal.stream.XMLStreamWriterImpl._autoPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._repairingPrefix, javolution.text.TextBuilder.append(), javolution.text.TextBuilder.clear(), javolution.text.CharArray.equals(), javolution.xml.internal.stream.NamespacesImpl.getPrefix(), and javolution.xml.internal.stream.NamespacesImpl.setPrefix().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEscaped()

boolean javolution.xml.internal.stream.XMLStreamWriterImpl.isEscaped ( char  c)
private

Definition at line 916 of file XMLStreamWriterImpl.java.

916  {
917  return ((c < ' ') && _isAttributeValue)
918  || (c == '"' && _isAttributeValue) || (c == '<') || (c == '>')
919  || (c == '&');
920  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isAttributeValue.

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeDirectEscapedCharacters().

Here is the caller graph for this function:

◆ reset()

void javolution.xml.internal.stream.XMLStreamWriterImpl.reset ( )

Definition at line 282 of file XMLStreamWriterImpl.java.

282  {
283  _automaticEmptyElements = false;
284  _autoNSCount = 0;
285  _encoding = null;
286  _indentation = null;
287  _indentationLevel = 0;
288  _index = 0;
289  _isAttributeValue = false;
290  _isElementOpen = false;
291  _isEmptyElement = false;
292  _isRepairingNamespaces = false;
293  _namespaces.reset();
294  _nesting = 0;
295  _noEmptyElementTag = false;
296  _repairingPrefix = "ns";
298  _writer = null;
299 
300  if (_factory != null)
301  _factory.recycle(this);
302  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLStreamWriterImpl._autoNSCount, javolution.xml.internal.stream.XMLStreamWriterImpl._encoding, javolution.xml.internal.stream.XMLStreamWriterImpl._factory, javolution.xml.internal.stream.XMLStreamWriterImpl._indentation, javolution.xml.internal.stream.XMLStreamWriterImpl._indentationLevel, javolution.xml.internal.stream.XMLStreamWriterImpl._index, javolution.xml.internal.stream.XMLStreamWriterImpl._isAttributeValue, javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLStreamWriterImpl._repairingPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl._utf8StreamWriter, javolution.xml.internal.stream.XMLStreamWriterImpl._writer, javolution.xml.internal.stream.XMLOutputFactoryImpl.recycle(), javolution.xml.internal.stream.NamespacesImpl.reset(), and javolution.io.UTF8StreamWriter.reset().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.close(), and javolution.xml.XMLFormat< T >.OutputElement.reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeElemStack()

void javolution.xml.internal.stream.XMLStreamWriterImpl.resizeElemStack ( )
private

Definition at line 783 of file XMLStreamWriterImpl.java.

783  {
784  final int oldLength = _qNames.length;
785  final int newLength = oldLength * 2;
786 
787  // Resizes elements qNames stack.
788  TextBuilder[] tmp = new TextBuilder[newLength];
789  System.arraycopy(_qNames, 0, tmp, 0, oldLength);
790  _qNames = tmp;
791  for (int i = oldLength; i < newLength; i++) {
792  _qNames[i] = new TextBuilder();
793  }
794  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._qNames, and javolution.text.TextBuilder.length().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAutomaticEmptyElements()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setAutomaticEmptyElements ( boolean  automaticEmptyElements)

Requires this writer to automatically output empty elements when a start element is immediately followed by matching end element (default false).

Parameters
automaticEmptyElementstrue if start element immediately followed by end element results in an empty element beign written; false otherwise.

Definition at line 265 of file XMLStreamWriterImpl.java.

265  {
266  _automaticEmptyElements = automaticEmptyElements;
267  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._automaticEmptyElements.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter(), and javolution.xml.XMLFormat< T >.OutputElement.reset().

Here is the caller graph for this function:

◆ setDefaultNamespace()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setDefaultNamespace ( CharSequence  uri) throws XMLStreamException

Binds a URI to the default namespace. This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Parameters
urithe uri to bind to the default namespace or null.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 604 of file XMLStreamWriterImpl.java.

604  {
606  }

References javolution.xml.internal.stream.NamespacesImpl._defaultNsPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, and javolution.xml.internal.stream.XMLStreamWriterImpl.setPrefix().

Here is the call graph for this function:

◆ setIndentation()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setIndentation ( String  indentation)

Specifies the indentation string; non-null indentation forces the writer to write elements into separate lines (default null).

Parameters
indentationthe indentation string.

Definition at line 243 of file XMLStreamWriterImpl.java.

243  {
244  _indentation = indentation;
245  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._indentation.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter().

Here is the caller graph for this function:

◆ setLineSeparator()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setLineSeparator ( String  lineSeparator)

Specifies the line separator (default "\n").

Parameters
lineSeparatorthe line separator string.

Definition at line 252 of file XMLStreamWriterImpl.java.

252  {
253  _lineSeparator = lineSeparator;
254  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._lineSeparator.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter().

Here is the caller graph for this function:

◆ setNoEmptyElementTag()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setNoEmptyElementTag ( boolean  noEmptyElementTag)

Prevent this writer from using empty element tags (default false).

Parameters
noEmptyElementTagtrue if empty element tags are replaced by start/end elements with no content; false otherwise.

Definition at line 277 of file XMLStreamWriterImpl.java.

277  {
278  _noEmptyElementTag = noEmptyElementTag;
279  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._noEmptyElementTag.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter().

Here is the caller graph for this function:

◆ setOutput() [1/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput ( OutputStream  out) throws XMLStreamException

Sets the output stream destination for this XML stream writer (UTF-8 encoding).

Parameters
outthe output source with utf-8 encoding.

Definition at line 170 of file XMLStreamWriterImpl.java.

170  {
172  _encoding = "UTF-8";
174  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._encoding, javolution.xml.internal.stream.XMLStreamWriterImpl._utf8StreamWriter, and javolution.io.UTF8StreamWriter.setOutput().

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter(), and javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOutput() [2/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput ( OutputStream  out,
String  encoding 
) throws XMLStreamException

Sets the output stream destination and encoding for this XML stream writer.

Parameters
outthe output source.
encodingthe associated encoding.
Exceptions
XMLStreamExceptionif the specified encoding is not supported.

Definition at line 184 of file XMLStreamWriterImpl.java.

185  {
186  if (encoding.equals("UTF-8") || encoding.equals("utf-8")
187  || encoding.equals("ASCII")) {
188  setOutput(out); // Default encoding.
189  } else {
190  try {
191  _encoding = encoding;
192  setOutput(new OutputStreamWriter(out, encoding));
193  } catch (UnsupportedEncodingException e) {
194  throw new XMLStreamException(e);
195  }
196  }
197  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._encoding, and javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput().

Here is the call graph for this function:

◆ setOutput() [3/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput ( Writer  writer) throws XMLStreamException

Sets the writer output destination for this XML stream writer.

Parameters
writerthe output destination writer.
See also
javolution.io.UTF8StreamWriter
javolution.io.UTF8ByteBufferWriter
javolution.io.AppendableWriter

Definition at line 207 of file XMLStreamWriterImpl.java.

207  {
208  if (_writer != null)
209  throw new IllegalStateException("Writer not closed or reset");
210  _writer = writer;
211  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._writer.

◆ setPrefix()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setPrefix ( CharSequence  prefix,
CharSequence  uri 
) throws XMLStreamException

Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.

Parameters
prefixthe prefix to bind to the uri.
urithe uri to bind to the prefix or null
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 597 of file XMLStreamWriterImpl.java.

598  {
599  _namespaces.setPrefix(prefix, (uri == null) ? _namespaces._nullNsURI
600  : uri, false);
601  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.NamespacesImpl._nullNsURI, and javolution.xml.internal.stream.NamespacesImpl.setPrefix().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.setDefaultNamespace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRepairingNamespaces()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setRepairingNamespaces ( boolean  isRepairingNamespaces)

Requires this writer to create a new prefix when a namespace has none (default false).

Parameters
isRepairingNamespacestrue if namespaces are repaired; false otherwise.

Definition at line 220 of file XMLStreamWriterImpl.java.

220  {
221  _isRepairingNamespaces = isRepairingNamespaces;
222  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter(), and javolution.xml.XMLFormat< T >.OutputElement.reset().

Here is the caller graph for this function:

◆ setRepairingPrefix()

void javolution.xml.internal.stream.XMLStreamWriterImpl.setRepairingPrefix ( String  repairingPrefix)

Specifies the prefix to be append by a trailing part (a sequence number) in order to make it unique to be usable as a temporary non-colliding prefix when repairing namespaces (default "ns").

Parameters
repairingPrefixthe prefix root.

Definition at line 232 of file XMLStreamWriterImpl.java.

232  {
233  _repairingPrefix = repairingPrefix;
234  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._repairingPrefix.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter().

Here is the caller graph for this function:

◆ write() [1/2]

final void javolution.xml.internal.stream.XMLStreamWriterImpl.write ( char  c) throws XMLStreamException
private

Definition at line 922 of file XMLStreamWriterImpl.java.

922  {
923  if (_index == BUFFER_LENGTH) {
924  flushBuffer();
925  }
926  _buffer[_index++] = c;
927  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._buffer, javolution.xml.internal.stream.XMLStreamWriterImpl._index, javolution.xml.internal.stream.XMLStreamWriterImpl.BUFFER_LENGTH, and javolution.xml.internal.stream.XMLStreamWriterImpl.flushBuffer().

Here is the call graph for this function:

◆ write() [2/2]

final void javolution.xml.internal.stream.XMLStreamWriterImpl.write ( Object  csq,
int  start,
int  length,
boolean  escapeMarkup 
) throws XMLStreamException
private

Definition at line 816 of file XMLStreamWriterImpl.java.

817  {
818  if (_index + length <= BUFFER_LENGTH) { // Enough buffer space.
819  if (csq instanceof String) {
820  ((String) csq).getChars(start, start + length, _buffer, _index);
821  } else if (csq instanceof javolution.text.Text) {
822  ((javolution.text.Text) csq).getChars(start, start + length,
823  _buffer, _index);
824  } else if (csq instanceof javolution.text.TextBuilder) {
825  ((javolution.text.TextBuilder) csq).getChars(start, start
826  + length, _buffer, _index);
827  } else if (csq instanceof javolution.text.CharArray) {
828  ((javolution.text.CharArray) csq).getChars(start, start
829  + length, _buffer, _index);
830  } else {
831  getChars((CharSequence) csq, start, start + length, _buffer,
832  _index);
833  }
834  if (escapeMarkup) {
835  int end = _index + length;
836  for (int i = _index; i < end; i++) {
837  char c = _buffer[i];
838  if ((c >= '?') || !isEscaped(c))
839  continue;
840  // Found character to escape.
841  _index = i;
842  flushBuffer();
844  return; // Done (buffer is empty).
845  }
846  }
847  _index += length;
848 
849  } else { // Not enough remaining space.
850  if (length <= BUFFER_LENGTH) { // Enough space if buffer emptied.
851  flushBuffer();
852  write(csq, start, length, escapeMarkup);
853  } else {
854  int half = length >> 1;
855  write(csq, start, half, escapeMarkup);
856  write(csq, start + half, length - half, escapeMarkup);
857  }
858  }
859  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._buffer, javolution.xml.internal.stream.XMLStreamWriterImpl._index, javolution.xml.internal.stream.XMLStreamWriterImpl.BUFFER_LENGTH, javolution.xml.internal.stream.XMLStreamWriterImpl.flushBuffer(), javolution.xml.internal.stream.XMLStreamWriterImpl.getChars(), javolution.xml.internal.stream.XMLStreamWriterImpl.isEscaped(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeDirectEscapedCharacters().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndElement(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEntityRef(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEscape(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeProcessingInstruction(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAttribute() [1/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttribute ( CharSequence  localName,
CharSequence  value 
) throws XMLStreamException

Writes an attribute to the output stream without a prefix.

Parameters
localNamethe local name of the attribute.
valuethe value of the attribute.
Exceptions
IllegalStateExceptionif the current state does not allow attribute writing.
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 418 of file XMLStreamWriterImpl.java.

419  {
420  if (localName == null)
421  throw new XMLStreamException("Local name cannot be null");
422  if (value == null)
423  throw new XMLStreamException("Value cannot be null");
424  writeAttributeOrNamespace(null, null, localName, value);
425  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace().

Referenced by javolution.xml.XMLFormat< T >.OutputElement.setAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAttribute() [2/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttribute ( CharSequence  namespaceURI,
CharSequence  localName,
CharSequence  value 
) throws XMLStreamException

Writes an attribute to the output stream.

Parameters
namespaceURIthe uri of the prefix for this attribute.
localNamethe local name of the attribute.
valuethe value of the attribute.
Exceptions
IllegalStateExceptionif the current state does not allow attribute writing.
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 428 of file XMLStreamWriterImpl.java.

430  {
431  if (localName == null)
432  throw new XMLStreamException("Local name cannot be null");
433  if (value == null)
434  throw new XMLStreamException("Value cannot be null");
435  if (namespaceURI == null)
436  throw new XMLStreamException("Namespace URI cannot be null");
437  writeAttributeOrNamespace(null, namespaceURI, localName, value);
438  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace().

Here is the call graph for this function:

◆ writeAttribute() [3/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttribute ( CharSequence  prefix,
CharSequence  namespaceURI,
CharSequence  localName,
CharSequence  value 
) throws XMLStreamException

Writes an attribute to the output stream.

Parameters
prefixthe prefix for this attribute.
namespaceURIthe uri of the prefix for this attribute
localNamethe local name of the attribute.
valuethe value of the attribute.
Exceptions
IllegalStateExceptionif the current state does not allow attribute writing.
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 441 of file XMLStreamWriterImpl.java.

443  {
444  if (localName == null)
445  throw new XMLStreamException("Local name cannot be null");
446  if (value == null)
447  throw new XMLStreamException("Value cannot be null");
448  if (namespaceURI == null)
449  throw new XMLStreamException("Namespace URI cannot be null");
450  if (prefix == null)
451  throw new XMLStreamException("Prefix cannot be null");
452  writeAttributeOrNamespace(prefix, namespaceURI, localName, value);
453  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace().

Here is the call graph for this function:

◆ writeAttributeOrNamespace()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace ( CharSequence  prefix,
CharSequence  namespaceURI,
CharSequence  localName,
CharSequence  value 
) throws XMLStreamException
private

Definition at line 674 of file XMLStreamWriterImpl.java.

676  {
677  if (!_isElementOpen)
678  throw new IllegalStateException("No open start element");
679  write(' ');
680 
681  // Writes prefix if any.
682  if ((namespaceURI != null)
683  && (!_namespaces._defaultNamespace.equals(namespaceURI))) {
684  if (_isRepairingNamespaces) { // Repairs prefix if current prefix is not correct.
685  prefix = getRepairedPrefix(prefix, namespaceURI);
686  } else if (prefix == null) {
687  prefix = getPrefix(namespaceURI);
688  if (prefix == null)
689  throw new XMLStreamException("URI: " + namespaceURI
690  + " not bound and repairing namespaces disabled");
691  }
692  if (prefix.length() > 0) {
693  writeNoEscape(prefix);
694  write(':');
695  }
696  }
697 
698  writeNoEscape(localName);
699  write('=');
700  write('"');
701  _isAttributeValue = true;
702  writeEscape(value);
703  _isAttributeValue = false;
704  write('"');
705  }

References javolution.xml.internal.stream.NamespacesImpl._defaultNamespace, javolution.xml.internal.stream.XMLStreamWriterImpl._isAttributeValue, javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.text.CharArray.equals(), javolution.xml.internal.stream.XMLStreamWriterImpl.getPrefix(), javolution.xml.internal.stream.XMLStreamWriterImpl.getRepairedPrefix(), javolution.xml.internal.stream.XMLStreamWriterImpl.write(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEscape(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttribute(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespaces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeCData()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeCData ( CharSequence  data) throws XMLStreamException

Writes a CData section.

Parameters
datathe data contained in the CData Section.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 511 of file XMLStreamWriterImpl.java.

511  {
512  if (data == null)
513  throw new XMLStreamException("Data cannot be null");
514  if (_isElementOpen)
515  closeOpenTag();
516  writeNoEscape("<![CDATA[");
517  writeNoEscape(data);
518  writeNoEscape("]]>");
519  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeCharacters() [1/2]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters ( char[]  text,
int  start,
int  length 
) throws XMLStreamException

Writes text to the output.

Parameters
textthe value to write
startthe starting position in the array.
lengththe number of characters to write.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 583 of file XMLStreamWriterImpl.java.

584  {
585  _tmpCharArray.setArray(text, start, length);
587  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._tmpCharArray, javolution.text.CharArray.setArray(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters().

Here is the call graph for this function:

◆ writeCharacters() [2/2]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters ( CharSequence  text) throws XMLStreamException

Writes text to the output.

Parameters
textthe value to write or null.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 574 of file XMLStreamWriterImpl.java.

574  {
575  if (_isElementOpen)
576  closeOpenTag();
577  if (text == null)
578  return;
579  writeEscape(text);
580  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeEscape().

Referenced by javolution.xml.XMLFormat< T >.OutputElement.addText(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeComment()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeComment ( CharSequence  data) throws XMLStreamException

Writes an xml comment with the data enclosed.

Parameters
datathe data contained in the comment or null
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 476 of file XMLStreamWriterImpl.java.

476  {
477  if (_isElementOpen)
478  closeOpenTag();
479  writeNoEscape("<!--");
480  if (data != null) { // null values allowed.
481  writeNoEscape(data);
482  }
483  writeNoEscape("-->");
484  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeDefaultNamespace()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeDefaultNamespace ( CharSequence  namespaceURI) throws XMLStreamException

Writes the default namespace to the stream.

Parameters
namespaceURIthe uri to bind the default namespace to or null (to map the prefix to "" URI)
Exceptions
IllegalStateExceptionif the current state does not allow namespace writing.
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 470 of file XMLStreamWriterImpl.java.

471  {
473  }

References javolution.xml.internal.stream.NamespacesImpl._defaultNsPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespace().

Here is the call graph for this function:

◆ writeDirectEscapedCharacters()

final void javolution.xml.internal.stream.XMLStreamWriterImpl.writeDirectEscapedCharacters ( char[]  chars,
int  start,
int  end 
) throws XMLStreamException
private

Definition at line 869 of file XMLStreamWriterImpl.java.

870  {
871  try {
872  int blockStart = start;
873  for (int i = start; i < end;) {
874  char c = chars[i++];
875  if ((c >= '?') || !isEscaped(c))
876  continue;
877  // Flush already read characters (excluding escaped one).
878  int blockLength = i - blockStart - 1;
879  if (blockLength > 0) {
880  _writer.write(_buffer, blockStart, blockLength);
881  }
882  blockStart = i;
883  switch (c) {
884  case '<':
885  _writer.write("&lt;");
886  break;
887  case '>':
888  _writer.write("&gt;");
889  break;
890  case '\'':
891  _writer.write("&apos;");
892  break;
893  case '"':
894  _writer.write("&quot;");
895  break;
896  case '&':
897  _writer.write("&amp;");
898  break;
899  default:
900  _writer.write("&#");
901  _writer.write((char) ('0' + c / 10));
902  _writer.write((char) ('0' + c % 10));
903  _writer.write(';');
904  }
905  }
906  // Flush the current block.
907  int blockLength = end - blockStart;
908  if (blockLength > 0) {
909  _writer.write(_buffer, blockStart, blockLength);
910  }
911  } catch (IOException e) {
912  throw new XMLStreamException(e);
913  }
914  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._buffer, javolution.xml.internal.stream.XMLStreamWriterImpl._writer, and javolution.xml.internal.stream.XMLStreamWriterImpl.isEscaped().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeDTD()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeDTD ( CharSequence  dtd) throws XMLStreamException

Writes a DTD section (representing the entire doctypedecl production from the XML 1.0 specification).

Parameters
dtdthe DTD to be written.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 522 of file XMLStreamWriterImpl.java.

522  {
523  if (dtd == null)
524  throw new XMLStreamException("DTD cannot be null");
525  if (_nesting > 0)
526  throw new XMLStreamException(
527  "DOCTYPE declaration (DTD) when not in document root (prolog)");
528  writeNoEscape(dtd);
529  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeEmptyElement() [1/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEmptyElement ( CharSequence  localName) throws XMLStreamException

Writes an empty element tag to the output.

Parameters
localNamelocal name of the tag.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 335 of file XMLStreamWriterImpl.java.

336  {
337  writeStartElement(localName);
338  _isEmptyElement = true;
339  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement().

Referenced by javolution.xml.XMLFormat< T >.OutputElement.add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeEmptyElement() [2/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEmptyElement ( CharSequence  namespaceURI,
CharSequence  localName 
) throws XMLStreamException

Writes an empty element tag to the output.

Parameters
namespaceURIthe uri to bind the tag to.
localNamelocal name of the tag.
Exceptions
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 342 of file XMLStreamWriterImpl.java.

343  {
344  writeStartElement(namespaceURI, localName);
345  _isEmptyElement = true;
346  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement().

Here is the call graph for this function:

◆ writeEmptyElement() [3/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEmptyElement ( CharSequence  prefix,
CharSequence  localName,
CharSequence  namespaceURI 
) throws XMLStreamException

Writes an empty element tag to the output.

Parameters
prefixthe prefix of the tag.
localNamelocal name of the tag.
namespaceURIthe uri to bind the tag to.
Exceptions
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 349 of file XMLStreamWriterImpl.java.

350  {
351  writeStartElement(prefix, localName, namespaceURI);
352  _isEmptyElement = true;
353  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement().

Here is the call graph for this function:

◆ writeEndDocument()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument ( ) throws XMLStreamException

Closes any start tags and writes corresponding end tags.

Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 387 of file XMLStreamWriterImpl.java.

387  {
388  if (_isElementOpen)
389  closeOpenTag();
390  while (_nesting > 0) { // Implicits closing of all elements.
391  writeEndElement();
392  }
393  flush(); // Not mandatory but safer.
394  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), javolution.xml.internal.stream.XMLStreamWriterImpl.flush(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndElement().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeEndElement()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndElement ( ) throws XMLStreamException

Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event.

Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 356 of file XMLStreamWriterImpl.java.

356  {
357  if (_isElementOpen) { // Empty element.
358  if (_isEmptyElement) { // Closes the empty element tag.
359  closeOpenTag();
360  } else { // Start element open.
361  if (_automaticEmptyElements) { // Do as if empty element written.
362  _isEmptyElement = true;
363  closeOpenTag();
364  return;
365  } else { // Closes the start element tag.
366  closeOpenTag();
367  }
368  }
369  }
370  if ((_indentation != null) && (_indentationLevel != _nesting - 1)) {
371  // Do not indent if no change in indentation level
372  // to avoid interfering with text only elements.
374  for (int i = 1; i < _nesting; i++) {
376  }
377  }
378 
379  write('<');
380  write('/');
382  write('>');
383  _namespaces.pop();
384  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLStreamWriterImpl._indentation, javolution.xml.internal.stream.XMLStreamWriterImpl._indentationLevel, javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement, javolution.xml.internal.stream.XMLStreamWriterImpl._lineSeparator, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl._qNames, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), javolution.xml.internal.stream.NamespacesImpl.pop(), javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Referenced by javolution.xml.XMLFormat< T >.OutputElement.add(), javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument(), and javolution.xml.XMLFormat< T >.OutputElement.writeReference().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeEntityRef()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEntityRef ( CharSequence  name) throws XMLStreamException

Writes an entity reference

Parameters
namethe name of the entity.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 532 of file XMLStreamWriterImpl.java.

532  {
533  write('&');
534  writeNoEscape(name);
535  write(';');
536  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeEscape()

final void javolution.xml.internal.stream.XMLStreamWriterImpl.writeEscape ( CharSequence  csq) throws XMLStreamException
private

Definition at line 812 of file XMLStreamWriterImpl.java.

812  {
813  write(csq, 0, csq.length(), true);
814  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeNamespace()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespace ( CharSequence  prefix,
CharSequence  namespaceURI 
) throws XMLStreamException

Writes a namespace to the output stream. If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace.

Parameters
prefixthe prefix to bind this namespace to or null
namespaceURIthe uri to bind the prefix.
Exceptions
IllegalStateExceptionif the current state does not allow namespace writing.
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 456 of file XMLStreamWriterImpl.java.

457  {
458  if ((prefix == null) || (prefix.length() == 0)
459  || _namespaces._xmlns.equals(prefix)) {
460  prefix = _namespaces._defaultNsPrefix;
461  }
462  if (!_isElementOpen) // Check now as the actual writting is queued.
463  throw new IllegalStateException("No open start element");
464  _namespaces.setPrefix(prefix,
465  (namespaceURI == null) ? _namespaces._nullNsURI : namespaceURI,
466  true);
467  }

References javolution.xml.internal.stream.NamespacesImpl._defaultNsPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.NamespacesImpl._nullNsURI, javolution.xml.internal.stream.NamespacesImpl._xmlns, javolution.text.CharArray.equals(), and javolution.xml.internal.stream.NamespacesImpl.setPrefix().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeDefaultNamespace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeNamespaces()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespaces ( ) throws XMLStreamException
private

Definition at line 735 of file XMLStreamWriterImpl.java.

735  {
736  int i0 = (_nesting > 1) ? _namespaces._namespacesCount[_nesting - 2]
737  : NamespacesImpl.NBR_PREDEFINED_NAMESPACES;
738  int i1 = _namespaces._namespacesCount[_nesting - 1];
740  for (int i = i0; i < i2; i++) {
741  if (((_isRepairingNamespaces && (i < i1) && !_namespaces._prefixesWritten[i]))
742  || ((i >= i1) && _namespaces._prefixesWritten[i])) { // Write namespace.
743 
744  // In repairing mode, removes redondancy.
746  CharArray prefix = _namespaces.getPrefix(
747  _namespaces._namespaces[i], i);
748  if (_namespaces._prefixes[i].equals(prefix))
749  continue; // Not necessary.
750  } // Direct mode, just write them as requested (no check).
751 
752  // Writes namespace.
753  if (_namespaces._prefixes[i].length() == 0) { // Default namespace.
756  } else {
760  }
761  }
762  }
763  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces, javolution.xml.internal.stream.NamespacesImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.NamespacesImpl._namespacesCount, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.NamespacesImpl._prefixes, javolution.xml.internal.stream.NamespacesImpl._prefixesWritten, javolution.xml.internal.stream.NamespacesImpl._xmlns, javolution.xml.internal.stream.NamespacesImpl._xmlnsURI, javolution.text.CharArray.equals(), javolution.xml.internal.stream.NamespacesImpl.getPrefix(), javolution.text.CharArray.length(), javolution.xml.internal.stream.NamespacesImpl.NBR_PREDEFINED_NAMESPACES, and javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeNewElement()

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement ( CharSequence  prefix,
CharSequence  localName,
CharSequence  namespaceURI 
) throws XMLStreamException
private

Definition at line 629 of file XMLStreamWriterImpl.java.

630  {
631 
632  // Close any open element and gets ready to write a new one.
633  if (_isElementOpen)
634  closeOpenTag();
635  if (_indentation != null) {
638  for (int i = 0; i < _indentationLevel; i++) {
640  }
641  }
642  write('<');
643  _isElementOpen = true;
644 
645  // Enters a new local scope.
646  if (++_nesting >= _qNames.length)
647  resizeElemStack();
648  _namespaces.push();
649 
650  // Constructs qName.
651  TextBuilder qName = _qNames[_nesting].clear();
652 
653  // Writes prefix if any.
654  if ((namespaceURI != null)
655  && (!_namespaces._defaultNamespace.equals(namespaceURI))) {
656  if (_isRepairingNamespaces) { // Repairs prefix.
657  prefix = getRepairedPrefix(prefix, namespaceURI);
658  } else if (prefix == null) { // Retrieves prefix.
659  prefix = getPrefix(namespaceURI);
660  if (prefix == null)
661  throw new XMLStreamException("URI: " + namespaceURI
662  + " not bound and repairing namespaces disabled");
663  }
664  if (prefix.length() > 0) {
665  qName.append(prefix);
666  qName.append(':');
667  }
668  }
669  qName.append(localName);
670  writeNoEscape(qName);
671  }

References javolution.xml.internal.stream.NamespacesImpl._defaultNamespace, javolution.xml.internal.stream.XMLStreamWriterImpl._indentation, javolution.xml.internal.stream.XMLStreamWriterImpl._indentationLevel, javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._lineSeparator, javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl._qNames, javolution.text.TextBuilder.append(), javolution.text.TextBuilder.clear(), javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), javolution.text.CharArray.equals(), javolution.xml.internal.stream.XMLStreamWriterImpl.getPrefix(), javolution.xml.internal.stream.XMLStreamWriterImpl.getRepairedPrefix(), javolution.text.TextBuilder.length(), javolution.xml.internal.stream.NamespacesImpl.push(), javolution.xml.internal.stream.XMLStreamWriterImpl.resizeElemStack(), javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeNoEscape() [1/3]

final void javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape ( CharSequence  csq) throws XMLStreamException
private

Definition at line 807 of file XMLStreamWriterImpl.java.

808  {
809  write(csq, 0, csq.length(), false);
810  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Here is the call graph for this function:

◆ writeNoEscape() [2/3]

◆ writeNoEscape() [3/3]

final void javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape ( TextBuilder  tb) throws XMLStreamException
private

Definition at line 803 of file XMLStreamWriterImpl.java.

803  {
804  write(tb, 0, tb.length(), false);
805  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.write().

Here is the call graph for this function:

◆ writeProcessingInstruction() [1/2]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeProcessingInstruction ( CharSequence  target) throws XMLStreamException

Writes a processing instruction.

Parameters
targetthe target of the processing instruction.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 487 of file XMLStreamWriterImpl.java.

488  {
490  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._noChar.

◆ writeProcessingInstruction() [2/2]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeProcessingInstruction ( CharSequence  target,
CharSequence  data 
) throws XMLStreamException

Writes a processing instruction

Parameters
targetthe target of the processing instruction.
datathe data contained in the processing instruction.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 495 of file XMLStreamWriterImpl.java.

496  {
497  if (target == null)
498  throw new XMLStreamException("Target cannot be null");
499  if (data == null)
500  throw new XMLStreamException("Data cannot be null");
501  if (_isElementOpen)
502  closeOpenTag();
503  writeNoEscape("<?");
504  writeNoEscape(target);
505  write(' ');
506  writeNoEscape(data);
507  writeNoEscape(" ?>");
508  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen, javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag(), javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeStartDocument() [1/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument ( ) throws XMLStreamException

Writes the XML Declaration. Defaults the XML version to 1.0 and the encoding (if any) to the one specified when the instance is created using XMLOutputFactory.

Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 539 of file XMLStreamWriterImpl.java.

539  {
540  writeStartDocument(null, null);
541  }

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument().

Here is the caller graph for this function:

◆ writeStartDocument() [2/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument ( CharSequence  encoding,
CharSequence  version 
) throws XMLStreamException

Writes the XML Declaration. Note that the encoding parameter does not set the actual encoding of the underlying output. That must be set when the instance when the instance is created using XMLOutputFactory.

Parameters
encodingthe encoding of the xml declaration or null.
versionthe version of the xml document or null.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 550 of file XMLStreamWriterImpl.java.

551  {
552  if (_nesting > 0)
553  throw new XMLStreamException("Not in document root");
554  writeNoEscape("<?xml version=\"");
555  if (version != null) {
556  writeNoEscape(version);
557  write('"');
558  } else { // Default to 1.0
559  writeNoEscape("1.0\"");
560  }
561  if (encoding != null) {
562  writeNoEscape(" encoding=\"");
563  writeNoEscape(encoding);
564  write('"');
565  } else if (_encoding != null) { // Use init encoding (if any).
566  writeNoEscape(" encoding=\"");
568  write('"');
569  }
570  writeNoEscape(" ?>");
571  }

References javolution.xml.internal.stream.XMLStreamWriterImpl._encoding, javolution.xml.internal.stream.XMLStreamWriterImpl._nesting, javolution.xml.internal.stream.XMLStreamWriterImpl.write(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape().

Here is the call graph for this function:

◆ writeStartDocument() [3/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument ( CharSequence  version) throws XMLStreamException

Writes the XML Declaration. Default the encoding (if any) to the one specified when the instance is created using XMLOutputFactory.

Parameters
versionthe version of the xml document or null.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 544 of file XMLStreamWriterImpl.java.

545  {
546  writeStartDocument(null, version);
547  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument().

Here is the call graph for this function:

◆ writeStartElement() [1/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement ( CharSequence  localName) throws XMLStreamException

Writes a start tag to the output. All writeStartElement methods open a new scope in the internal namespace context. Writing the corresponding EndElement causes the scope to be closed.

Parameters
localNamelocal name of the tag.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 305 of file XMLStreamWriterImpl.java.

306  {
307  if (localName == null)
308  throw new XMLStreamException("Local name cannot be null");
309  writeNewElement(null, localName, null);
310  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Referenced by javolution.xml.XMLFormat< T >.OutputElement.add(), and javolution.xml.internal.stream.XMLStreamWriterImpl.writeEmptyElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeStartElement() [2/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement ( CharSequence  namespaceURI,
CharSequence  localName 
) throws XMLStreamException

Writes a start tag to the output.

Parameters
namespaceURIthe namespaceURI of the prefix to use.
localNamelocal name of the tag.
Exceptions
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 313 of file XMLStreamWriterImpl.java.

314  {
315  if (localName == null)
316  throw new XMLStreamException("Local name cannot be null");
317  if (namespaceURI == null)
318  throw new XMLStreamException("Namespace URI cannot be null");
319  writeNewElement(null, localName, namespaceURI);
320  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Here is the call graph for this function:

◆ writeStartElement() [3/3]

void javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement ( CharSequence  prefix,
CharSequence  localName,
CharSequence  namespaceURI 
) throws XMLStreamException

Writes a start tag to the output.

Parameters
localNamelocal name of the tag.
prefixthe prefix of the tag.
namespaceURIthe uri to bind the prefix to.
Exceptions
XMLStreamExceptionif the namespace URI has not been bound to a prefix and this writer does not repair namespaces.

Implements javolution.xml.stream.XMLStreamWriter.

Definition at line 323 of file XMLStreamWriterImpl.java.

324  {
325  if (localName == null)
326  throw new XMLStreamException("Local name cannot be null");
327  if (namespaceURI == null)
328  throw new XMLStreamException("Namespace URI cannot be null");
329  if (prefix == null)
330  throw new XMLStreamException("Prefix cannot be null");
331  writeNewElement(prefix, localName, namespaceURI);
332  }

References javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement().

Here is the call graph for this function:

Member Data Documentation

◆ _automaticEmptyElements

◆ _autoNSCount

int javolution.xml.internal.stream.XMLStreamWriterImpl._autoNSCount
private

◆ _autoPrefix

final TextBuilder javolution.xml.internal.stream.XMLStreamWriterImpl._autoPrefix = new TextBuilder()
private

◆ _buffer

final char [] javolution.xml.internal.stream.XMLStreamWriterImpl._buffer = new char[BUFFER_LENGTH]
private

◆ _encoding

String javolution.xml.internal.stream.XMLStreamWriterImpl._encoding
private

◆ _factory

final XMLOutputFactoryImpl javolution.xml.internal.stream.XMLStreamWriterImpl._factory
private

◆ _indentation

◆ _indentationLevel

int javolution.xml.internal.stream.XMLStreamWriterImpl._indentationLevel
private

◆ _index

int javolution.xml.internal.stream.XMLStreamWriterImpl._index
private

◆ _isAttributeValue

boolean javolution.xml.internal.stream.XMLStreamWriterImpl._isAttributeValue
private

◆ _isElementOpen

◆ _isEmptyElement

boolean javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement
private

◆ _isRepairingNamespaces

◆ _lineSeparator

◆ _namespaces

◆ _nesting

◆ _noChar

final CharArray javolution.xml.internal.stream.XMLStreamWriterImpl._noChar = new CharArray("")
private

◆ _noEmptyElementTag

◆ _qNames

◆ _repairingPrefix

◆ _tmpCharArray

final CharArray javolution.xml.internal.stream.XMLStreamWriterImpl._tmpCharArray = new CharArray()
private

◆ _utf8StreamWriter

final UTF8StreamWriter javolution.xml.internal.stream.XMLStreamWriterImpl._utf8StreamWriter = new UTF8StreamWriter()
private

Holds the default writer for output streams.

Definition at line 140 of file XMLStreamWriterImpl.java.

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.reset(), and javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput().

◆ _writer

◆ BUFFER_LENGTH

final int javolution.xml.internal.stream.XMLStreamWriterImpl.BUFFER_LENGTH = 2048
staticprivate

Holds the length of intermediate buffer.

Definition at line 41 of file XMLStreamWriterImpl.java.

Referenced by javolution.xml.internal.stream.XMLStreamWriterImpl.write().


The documentation for this class was generated from the following file:
javolution.xml.internal.stream.XMLStreamWriterImpl.write
final void write(Object csq, int start, int length, boolean escapeMarkup)
Definition: XMLStreamWriterImpl.java:816
javolution.xml.internal.stream.XMLStreamWriterImpl._nesting
int _nesting
Definition: XMLStreamWriterImpl.java:46
javolution.xml.internal.stream.NamespacesImpl.setPrefix
void setPrefix(CharArray prefix, CharArray uri)
Definition: NamespacesImpl.java:152
javolution.text.CharArray
Definition: CharArray.java:36
javolution
javolution.xml.internal.stream.NamespacesImpl.getPrefix
CharArray getPrefix(CharSequence uri)
Definition: NamespacesImpl.java:113
javolution.xml.internal.stream.NamespacesImpl._defaultNsPrefix
final CharArray _defaultNsPrefix
Definition: NamespacesImpl.java:35
javolution.xml.internal.stream.XMLStreamWriterImpl._autoPrefix
final TextBuilder _autoPrefix
Definition: XMLStreamWriterImpl.java:780
javolution.xml.internal.stream.XMLStreamWriterImpl.writeProcessingInstruction
void writeProcessingInstruction(CharSequence target)
Definition: XMLStreamWriterImpl.java:487
javolution.text.TextBuilder.append
final TextBuilder append(char c)
Definition: TextBuilder.java:202
javolution.xml.internal.stream.XMLStreamWriterImpl._qNames
TextBuilder[] _qNames
Definition: XMLStreamWriterImpl.java:51
javolution.text.Text
Definition: Text.java:62
javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndElement
void writeEndElement()
Definition: XMLStreamWriterImpl.java:356
javolution.xml.internal.stream.XMLStreamWriterImpl.flushBuffer
void flushBuffer()
Definition: XMLStreamWriterImpl.java:929
javolution.text.TextBuilder
Definition: TextBuilder.java:29
javolution.text.TextBuilder.clear
final TextBuilder clear()
Definition: TextBuilder.java:725
javolution.xml.internal.stream.NamespacesImpl._xmlnsURI
final CharArray _xmlnsURI
Definition: NamespacesImpl.java:44
javolution.xml.internal.stream.XMLStreamWriterImpl._index
int _index
Definition: XMLStreamWriterImpl.java:76
javolution.xml.internal.stream.NamespacesImpl.push
void push()
Definition: NamespacesImpl.java:219
javolution.io.UTF8StreamWriter.setOutput
UTF8StreamWriter setOutput(OutputStream out)
Definition: UTF8StreamWriter.java:82
javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartElement
void writeStartElement(CharSequence localName)
Definition: XMLStreamWriterImpl.java:305
javolution.xml.internal.stream.XMLStreamWriterImpl._repairingPrefix
String _repairingPrefix
Definition: XMLStreamWriterImpl.java:86
javolution.xml.internal.stream.XMLStreamWriterImpl.getRepairedPrefix
CharSequence getRepairedPrefix(CharSequence prefix, CharSequence namespaceURI)
Definition: XMLStreamWriterImpl.java:766
javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput
void setOutput(OutputStream out)
Definition: XMLStreamWriterImpl.java:170
javolution.xml.internal.stream.XMLStreamWriterImpl.flush
void flush()
Definition: XMLStreamWriterImpl.java:408
javolution.text.CharArray.equals
boolean equals(Object that)
Definition: CharArray.java:204
javolution.xml.internal.stream.XMLStreamWriterImpl._tmpCharArray
final CharArray _tmpCharArray
Definition: XMLStreamWriterImpl.java:589
javolution.xml.internal.stream.XMLStreamWriterImpl._encoding
String _encoding
Definition: XMLStreamWriterImpl.java:135
javolution.xml.internal.stream.NamespacesImpl._prefixes
CharArray[] _prefixes
Definition: NamespacesImpl.java:54
javolution.xml.internal.stream.XMLStreamWriterImpl._indentationLevel
int _indentationLevel
Definition: XMLStreamWriterImpl.java:101
javolution.xml.internal.stream.XMLStreamWriterImpl.BUFFER_LENGTH
static final int BUFFER_LENGTH
Definition: XMLStreamWriterImpl.java:41
javolution.xml.internal.stream.NamespacesImpl._namespacesCount
int[] _namespacesCount
Definition: NamespacesImpl.java:69
javolution.xml.internal.stream.XMLStreamWriterImpl._lineSeparator
String _lineSeparator
Definition: XMLStreamWriterImpl.java:96
javolution.xml.internal.stream.XMLStreamWriterImpl._namespaces
final NamespacesImpl _namespaces
Definition: XMLStreamWriterImpl.java:71
javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespaces
void writeNamespaces()
Definition: XMLStreamWriterImpl.java:735
javolution.text
Definition: CharArray.java:9
javolution.xml.internal.stream.NamespacesImpl.reset
void reset()
Definition: NamespacesImpl.java:227
javolution.text.TextBuilder.length
final int length()
Definition: TextBuilder.java:91
javolution.xml.internal.stream.XMLStreamWriterImpl._automaticEmptyElements
boolean _automaticEmptyElements
Definition: XMLStreamWriterImpl.java:106
javolution.xml.internal.stream.XMLStreamWriterImpl.writeNamespace
void writeNamespace(CharSequence prefix, CharSequence namespaceURI)
Definition: XMLStreamWriterImpl.java:456
javolution.xml.internal.stream.XMLStreamWriterImpl.reset
void reset()
Definition: XMLStreamWriterImpl.java:282
javolution.xml.internal.stream.XMLStreamWriterImpl.isEscaped
boolean isEscaped(char c)
Definition: XMLStreamWriterImpl.java:916
javolution.text.CharArray.length
int length()
Definition: CharArray.java:95
javolution.xml.internal.stream.XMLStreamWriterImpl.resizeElemStack
void resizeElemStack()
Definition: XMLStreamWriterImpl.java:783
javolution.xml.internal.stream.XMLStreamWriterImpl._factory
final XMLOutputFactoryImpl _factory
Definition: XMLStreamWriterImpl.java:145
javolution.xml.internal.stream.XMLStreamWriterImpl.writeAttributeOrNamespace
void writeAttributeOrNamespace(CharSequence prefix, CharSequence namespaceURI, CharSequence localName, CharSequence value)
Definition: XMLStreamWriterImpl.java:674
javolution.xml.internal.stream.XMLStreamWriterImpl.getPrefix
CharSequence getPrefix(CharSequence uri)
Definition: XMLStreamWriterImpl.java:592
javolution.xml.internal.stream.XMLStreamWriterImpl.writeNewElement
void writeNewElement(CharSequence prefix, CharSequence localName, CharSequence namespaceURI)
Definition: XMLStreamWriterImpl.java:629
javolution.xml.internal.stream.XMLStreamWriterImpl.getChars
static void getChars(CharSequence csq, int start, int end, char dest[], int destPos)
Definition: XMLStreamWriterImpl.java:861
javolution.xml.internal.stream.XMLStreamWriterImpl._noChar
final CharArray _noChar
Definition: XMLStreamWriterImpl.java:492
javolution.xml.internal.stream.XMLStreamWriterImpl._isEmptyElement
boolean _isEmptyElement
Definition: XMLStreamWriterImpl.java:61
javolution.xml.internal.stream.XMLOutputFactoryImpl.recycle
void recycle(XMLStreamWriterImpl xmlWriter)
Definition: XMLOutputFactoryImpl.java:124
javolution.xml.internal.stream.XMLStreamWriterImpl._noEmptyElementTag
boolean _noEmptyElementTag
Definition: XMLStreamWriterImpl.java:111
javolution.xml.internal.stream.XMLStreamWriterImpl._isAttributeValue
boolean _isAttributeValue
Definition: XMLStreamWriterImpl.java:121
javolution.xml.internal.stream.XMLStreamWriterImpl._autoNSCount
int _autoNSCount
Definition: XMLStreamWriterImpl.java:116
javolution.xml.internal.stream.XMLStreamWriterImpl.closeOpenTag
void closeOpenTag()
Definition: XMLStreamWriterImpl.java:708
javolution.xml.internal.stream.XMLStreamWriterImpl.writeEndDocument
void writeEndDocument()
Definition: XMLStreamWriterImpl.java:387
javolution.xml.internal.stream.XMLStreamWriterImpl._isRepairingNamespaces
boolean _isRepairingNamespaces
Definition: XMLStreamWriterImpl.java:81
javolution.xml.internal.stream.XMLStreamWriterImpl.writeStartDocument
void writeStartDocument()
Definition: XMLStreamWriterImpl.java:539
javolution.xml.internal.stream.NamespacesImpl._namespaces
CharArray[] _namespaces
Definition: NamespacesImpl.java:59
javolution.xml.internal.stream.XMLStreamWriterImpl.writeDirectEscapedCharacters
final void writeDirectEscapedCharacters(char[] chars, int start, int end)
Definition: XMLStreamWriterImpl.java:869
javolution.io.UTF8StreamWriter.reset
void reset()
Definition: UTF8StreamWriter.java:326
javolution.xml.internal.stream.XMLStreamWriterImpl.writeEscape
final void writeEscape(CharSequence csq)
Definition: XMLStreamWriterImpl.java:812
javolution.xml.internal.stream.NamespacesImpl._nullNsURI
final CharArray _nullNsURI
Definition: NamespacesImpl.java:33
javolution.xml.internal.stream.NamespacesImpl._xmlns
final CharArray _xmlns
Definition: NamespacesImpl.java:42
javolution.xml.internal.stream.XMLStreamWriterImpl._buffer
final char[] _buffer
Definition: XMLStreamWriterImpl.java:66
javolution.xml.internal.stream.XMLStreamWriterImpl._indentation
String _indentation
Definition: XMLStreamWriterImpl.java:91
javolution.xml.internal.stream.XMLStreamWriterImpl.writeNoEscape
final void writeNoEscape(String str)
Definition: XMLStreamWriterImpl.java:799
javolution.text.CharArray.setArray
CharArray setArray(char[] array, int offset, int length)
Definition: CharArray.java:116
javolution.xml.internal.stream.NamespacesImpl._defaultNamespace
CharArray _defaultNamespace
Definition: NamespacesImpl.java:74
javolution.xml.internal.stream.XMLStreamWriterImpl.writeCharacters
void writeCharacters(CharSequence text)
Definition: XMLStreamWriterImpl.java:574
javolution.xml.internal.stream.NamespacesImpl._prefixesWritten
boolean[] _prefixesWritten
Definition: NamespacesImpl.java:64
javolution.xml.internal.stream.NamespacesImpl.pop
void pop()
Definition: NamespacesImpl.java:202
javolution.xml.internal.stream.XMLStreamWriterImpl._utf8StreamWriter
final UTF8StreamWriter _utf8StreamWriter
Definition: XMLStreamWriterImpl.java:140
javolution.xml.internal.stream.XMLStreamWriterImpl._isElementOpen
boolean _isElementOpen
Definition: XMLStreamWriterImpl.java:56
javolution.xml.internal.stream.XMLStreamWriterImpl._writer
Writer _writer
Definition: XMLStreamWriterImpl.java:130
javolution.xml.internal.stream.XMLStreamWriterImpl.setPrefix
void setPrefix(CharSequence prefix, CharSequence uri)
Definition: XMLStreamWriterImpl.java:597