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

Public Member Functions

XMLStreamWriterImpl createXMLStreamWriter (OutputStream stream) throws XMLStreamException
 
XMLStreamWriterImpl createXMLStreamWriter (OutputStream stream, String encoding) throws XMLStreamException
 
XMLStreamWriterImpl createXMLStreamWriter (Writer writer) throws XMLStreamException
 
Object getProperty (String name) throws IllegalArgumentException
 
boolean isPropertySupported (String name)
 
void setProperty (String name, Object value) throws IllegalArgumentException
 
XMLOutputFactory clone ()
 

Static Public Attributes

static final String IS_REPAIRING_NAMESPACES = "javolution.xml.stream.isRepairingNamespaces"
 
static final String REPAIRING_PREFIX = "javolution.xml.stream.repairingPrefix"
 
static final String INDENTATION = "javolution.xml.stream.indentation"
 
static final String LINE_SEPARATOR = "javolution.xml.stream.lineSeparator"
 
static final String AUTOMATIC_EMPTY_ELEMENTS = "javolution.xml.stream.automaticEmptyElements"
 
static final String NO_EMPTY_ELEMENT_TAG = "javolution.xml.stream.noEmptyElementTag"
 

Package Functions

void recycle (XMLStreamWriterImpl xmlWriter)
 

Private Member Functions

XMLStreamWriterImpl newWriter ()
 

Private Attributes

Boolean _automaticEmptyElements = Boolean.FALSE
 
String _indentation
 
Boolean _isRepairingNamespaces = Boolean.FALSE
 
String _lineSeparator = "\n"
 
Boolean _noEmptyElementTag = Boolean.FALSE
 
String _repairingPrefix = "ns"
 
FastTable< XMLStreamWriterImpl_recycled
 

Detailed Description

This default XML Output factory implementation.

Definition at line 21 of file XMLOutputFactoryImpl.java.

Member Function Documentation

◆ clone()

XMLOutputFactory javolution.xml.internal.stream.XMLOutputFactoryImpl.clone ( )

Returns a clone of this factory which can be independently configured.

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 142 of file XMLOutputFactoryImpl.java.

142  {
143  try {
144  XMLOutputFactoryImpl clone = (XMLOutputFactoryImpl) super.clone();
145  clone._recycled = new FastTable<XMLStreamWriterImpl>().shared();
146  return clone;
147  } catch (CloneNotSupportedException e) {
148  throw new Error();// Cannot happen since cloneable.
149  }
150  }

References javolution.xml.stream.XMLOutputFactory.clone(), and javolution.util.FastTable< E >.shared().

Here is the call graph for this function:

◆ createXMLStreamWriter() [1/3]

XMLStreamWriterImpl javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter ( OutputStream  stream) throws XMLStreamException

Returns a XML stream writer to the specified output stream (UTF-8 encoding).

Parameters
streamthe stream to write to.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 45 of file XMLOutputFactoryImpl.java.

46  {
47  XMLStreamWriterImpl xmlWriter = newWriter();
48  xmlWriter.setOutput(stream);
49  return xmlWriter;
50  }

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

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

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

◆ createXMLStreamWriter() [2/3]

XMLStreamWriterImpl javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter ( OutputStream  stream,
String  encoding 
) throws XMLStreamException

Returns a XML stream writer to the specified output stream using the specified encoding.

Parameters
streamthe stream to write to.
encodingthe encoding to use.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 53 of file XMLOutputFactoryImpl.java.

54  {
55  if ((encoding == null) || encoding.equals("UTF-8")
56  || encoding.equals("utf-8"))
57  return createXMLStreamWriter(stream);
58  XMLStreamWriterImpl xmlWriter = newWriter();
59  xmlWriter.setOutput(stream, encoding);
60  return xmlWriter;
61  }

References javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter(), javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter(), and javolution.xml.internal.stream.XMLStreamWriterImpl.setOutput().

Here is the call graph for this function:

◆ createXMLStreamWriter() [3/3]

XMLStreamWriterImpl javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter ( Writer  writer) throws XMLStreamException

Returns a XML stream writer to the specified i/o writer.

Parameters
writerthe writer to write to.
Returns
a xml stream writer possibly recycled.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 64 of file XMLOutputFactoryImpl.java.

65  {
66  XMLStreamWriterImpl xmlWriter = newWriter();
67  xmlWriter.setOutput(writer);
68  return xmlWriter;
69  }

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

Here is the call graph for this function:

◆ getProperty()

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

Gets a feature/property on 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.XMLOutputFactory.

Definition at line 72 of file XMLOutputFactoryImpl.java.

72  {
73  if (name.equals(IS_REPAIRING_NAMESPACES)) {
75  } else if (name.equals(REPAIRING_PREFIX)) {
76  return _repairingPrefix;
77  } else if (name.equals(AUTOMATIC_EMPTY_ELEMENTS)) {
79  } else if (name.equals(NO_EMPTY_ELEMENT_TAG)) {
80  return _noEmptyElementTag;
81  } else if (name.equals(INDENTATION)) {
82  return _indentation;
83  } else if (name.equals(LINE_SEPARATOR)) {
84  return _lineSeparator;
85  } else {
86  throw new IllegalArgumentException("Property: " + name
87  + " not supported");
88  }
89  }

References javolution.xml.internal.stream.XMLOutputFactoryImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLOutputFactoryImpl._indentation, javolution.xml.internal.stream.XMLOutputFactoryImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLOutputFactoryImpl._lineSeparator, javolution.xml.internal.stream.XMLOutputFactoryImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLOutputFactoryImpl._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.

◆ isPropertySupported()

boolean javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported ( String  name)

Queries the set of properties that this factory supports.

Parameters
namethe name of the property (may not be null).
Returns
true if the property is supported; false otherwise.

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 92 of file XMLOutputFactoryImpl.java.

92  {
93  return name.equals(IS_REPAIRING_NAMESPACES)
94  || name.equals(REPAIRING_PREFIX)
95  || name.equals(AUTOMATIC_EMPTY_ELEMENTS)
96  || name.equals(NO_EMPTY_ELEMENT_TAG)
97  || name.equals(INDENTATION) || name.equals(LINE_SEPARATOR);
98  }

References 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.

◆ newWriter()

XMLStreamWriterImpl javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter ( )
private

Definition at line 128 of file XMLOutputFactoryImpl.java.

128  {
129  XMLStreamWriterImpl xmlWriter = _recycled.pollLast();
130  if (xmlWriter == null) xmlWriter = new XMLStreamWriterImpl(this);
131  xmlWriter.setRepairingNamespaces(_isRepairingNamespaces.booleanValue());
132  xmlWriter.setRepairingPrefix(_repairingPrefix);
133  xmlWriter.setIndentation(_indentation);
134  xmlWriter.setLineSeparator(_lineSeparator);
135  xmlWriter.setAutomaticEmptyElements(_automaticEmptyElements
136  .booleanValue());
137  xmlWriter.setNoEmptyElementTag(_noEmptyElementTag.booleanValue());
138  return xmlWriter;
139  }

References javolution.xml.internal.stream.XMLOutputFactoryImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLOutputFactoryImpl._indentation, javolution.xml.internal.stream.XMLOutputFactoryImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLOutputFactoryImpl._lineSeparator, javolution.xml.internal.stream.XMLOutputFactoryImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLOutputFactoryImpl._recycled, javolution.xml.internal.stream.XMLOutputFactoryImpl._repairingPrefix, javolution.xml.internal.stream.XMLStreamWriterImpl.setAutomaticEmptyElements(), javolution.xml.internal.stream.XMLStreamWriterImpl.setIndentation(), javolution.xml.internal.stream.XMLStreamWriterImpl.setLineSeparator(), javolution.xml.internal.stream.XMLStreamWriterImpl.setNoEmptyElementTag(), javolution.xml.internal.stream.XMLStreamWriterImpl.setRepairingNamespaces(), and javolution.xml.internal.stream.XMLStreamWriterImpl.setRepairingPrefix().

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

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

◆ recycle()

void javolution.xml.internal.stream.XMLOutputFactoryImpl.recycle ( XMLStreamWriterImpl  xmlWriter)
package

Recycles the specified writer instance.

Definition at line 124 of file XMLOutputFactoryImpl.java.

124  {
125  _recycled.addLast(xmlWriter);
126  }

References javolution.xml.internal.stream.XMLOutputFactoryImpl._recycled.

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

Here is the caller graph for this function:

◆ setProperty()

void javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty ( String  name,
Object  value 
) throws IllegalArgumentException

Allows the user to set specific features/properties on the underlying implementation.

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

Implements javolution.xml.stream.XMLOutputFactory.

Definition at line 101 of file XMLOutputFactoryImpl.java.

102  {
103  if (name.equals(IS_REPAIRING_NAMESPACES)) {
104  _isRepairingNamespaces = (Boolean) value;
105  } else if (name.equals(REPAIRING_PREFIX)) {
106  _repairingPrefix = (String) value;
107  } else if (name.equals(AUTOMATIC_EMPTY_ELEMENTS)) {
108  _automaticEmptyElements = (Boolean) value;
109  } else if (name.equals(NO_EMPTY_ELEMENT_TAG)) {
110  _noEmptyElementTag = (Boolean) value;
111  } else if (name.equals(INDENTATION)) {
112  _indentation = (String) value;
113  } else if (name.equals(LINE_SEPARATOR)) {
114  _lineSeparator = (String) value;
115  } else {
116  throw new IllegalArgumentException("Property: " + name
117  + " not supported");
118  }
119  }

References javolution.xml.internal.stream.XMLOutputFactoryImpl._automaticEmptyElements, javolution.xml.internal.stream.XMLOutputFactoryImpl._indentation, javolution.xml.internal.stream.XMLOutputFactoryImpl._isRepairingNamespaces, javolution.xml.internal.stream.XMLOutputFactoryImpl._lineSeparator, javolution.xml.internal.stream.XMLOutputFactoryImpl._noEmptyElementTag, javolution.xml.internal.stream.XMLOutputFactoryImpl._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.

Member Data Documentation

◆ _automaticEmptyElements

Boolean javolution.xml.internal.stream.XMLOutputFactoryImpl._automaticEmptyElements = Boolean.FALSE
private

◆ _indentation

◆ _isRepairingNamespaces

Boolean javolution.xml.internal.stream.XMLOutputFactoryImpl._isRepairingNamespaces = Boolean.FALSE
private

◆ _lineSeparator

◆ _noEmptyElementTag

Boolean javolution.xml.internal.stream.XMLOutputFactoryImpl._noEmptyElementTag = Boolean.FALSE
private

◆ _recycled

FastTable<XMLStreamWriterImpl> javolution.xml.internal.stream.XMLOutputFactoryImpl._recycled
private
Initial value:
= new FastTable<XMLStreamWriterImpl>()
.shared()

Definition at line 41 of file XMLOutputFactoryImpl.java.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.recycle().

◆ _repairingPrefix

◆ AUTOMATIC_EMPTY_ELEMENTS

final String javolution.xml.stream.XMLOutputFactory.AUTOMATIC_EMPTY_ELEMENTS = "javolution.xml.stream.automaticEmptyElements"
staticinherited

Property indicating if the stream writers are allowed to automatically output empty elements when a start element is immediately followed by matching end element (type: Boolean, default: FALSE).

Definition at line 92 of file XMLOutputFactory.java.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().

◆ INDENTATION

final String javolution.xml.stream.XMLOutputFactory.INDENTATION = "javolution.xml.stream.indentation"
staticinherited

Property used to specify an indentation string; non-null indentation forces the writer to write elements into separate lines (type: String, default: null).

Definition at line 78 of file XMLOutputFactory.java.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().

◆ IS_REPAIRING_NAMESPACES

final String javolution.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES = "javolution.xml.stream.isRepairingNamespaces"
staticinherited

◆ LINE_SEPARATOR

final String javolution.xml.stream.XMLOutputFactory.LINE_SEPARATOR = "javolution.xml.stream.lineSeparator"
staticinherited

◆ NO_EMPTY_ELEMENT_TAG

final String javolution.xml.stream.XMLOutputFactory.NO_EMPTY_ELEMENT_TAG = "javolution.xml.stream.noEmptyElementTag"
staticinherited

Property indicating if the stream writers are not allowed to use empty element tags (type: Boolean, default: FALSE). When set, this property forces the use of start/end element tag (e.g. i.e. "&lt;empty /&gt;" replaced by "&lt;empty&gt;&lt;/empty&gt;"), This property takes precedence over AUTOMATIC_EMPTY_ELEMENTS.

Definition at line 102 of file XMLOutputFactory.java.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().

◆ REPAIRING_PREFIX

final String javolution.xml.stream.XMLOutputFactory.REPAIRING_PREFIX = "javolution.xml.stream.repairingPrefix"
staticinherited

Property used to specify the prefix to be appended 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 (type: String, default: "ns").

Definition at line 71 of file XMLOutputFactory.java.

Referenced by javolution.xml.internal.stream.XMLOutputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamWriterImpl.getProperty(), javolution.xml.internal.stream.XMLOutputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLOutputFactoryImpl.setProperty().


The documentation for this class was generated from the following file:
javolution.xml.stream.XMLOutputFactory.LINE_SEPARATOR
static final String LINE_SEPARATOR
Definition: XMLOutputFactory.java:84
javolution.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES
static final String IS_REPAIRING_NAMESPACES
Definition: XMLOutputFactory.java:63
javolution.xml.internal.stream.XMLOutputFactoryImpl._indentation
String _indentation
Definition: XMLOutputFactoryImpl.java:27
javolution.xml.internal.stream.XMLOutputFactoryImpl._noEmptyElementTag
Boolean _noEmptyElementTag
Definition: XMLOutputFactoryImpl.java:36
javolution.xml.stream.XMLOutputFactory.NO_EMPTY_ELEMENT_TAG
static final String NO_EMPTY_ELEMENT_TAG
Definition: XMLOutputFactory.java:102
javolution.xml.internal.stream.XMLOutputFactoryImpl._isRepairingNamespaces
Boolean _isRepairingNamespaces
Definition: XMLOutputFactoryImpl.java:30
javolution.xml.internal.stream.XMLOutputFactoryImpl.clone
XMLOutputFactory clone()
Definition: XMLOutputFactoryImpl.java:142
javolution.xml.internal.stream.XMLOutputFactoryImpl._repairingPrefix
String _repairingPrefix
Definition: XMLOutputFactoryImpl.java:39
javolution.xml.internal.stream.XMLOutputFactoryImpl._automaticEmptyElements
Boolean _automaticEmptyElements
Definition: XMLOutputFactoryImpl.java:24
javolution.xml.stream.XMLOutputFactory.AUTOMATIC_EMPTY_ELEMENTS
static final String AUTOMATIC_EMPTY_ELEMENTS
Definition: XMLOutputFactory.java:92
javolution.xml.stream.XMLOutputFactory.clone
XMLOutputFactory clone()
javolution.xml.internal.stream.XMLOutputFactoryImpl._recycled
FastTable< XMLStreamWriterImpl > _recycled
Definition: XMLOutputFactoryImpl.java:41
javolution.xml.stream.XMLOutputFactory.REPAIRING_PREFIX
static final String REPAIRING_PREFIX
Definition: XMLOutputFactory.java:71
javolution.xml.internal.stream.XMLOutputFactoryImpl.createXMLStreamWriter
XMLStreamWriterImpl createXMLStreamWriter(OutputStream stream)
Definition: XMLOutputFactoryImpl.java:45
javolution.xml.internal.stream.XMLOutputFactoryImpl._lineSeparator
String _lineSeparator
Definition: XMLOutputFactoryImpl.java:33
javolution.xml.stream.XMLOutputFactory.INDENTATION
static final String INDENTATION
Definition: XMLOutputFactory.java:78
javolution.xml.internal.stream.XMLOutputFactoryImpl.newWriter
XMLStreamWriterImpl newWriter()
Definition: XMLOutputFactoryImpl.java:128