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

Public Member Functions

XMLStreamReaderImpl createXMLStreamReader (InputStream stream) throws XMLStreamException
 
XMLStreamReaderImpl createXMLStreamReader (InputStream stream, String encoding) throws XMLStreamException
 
XMLStreamReaderImpl createXMLStreamReader (Reader reader) throws XMLStreamException
 
Object getProperty (String name) throws IllegalArgumentException
 
boolean isPropertySupported (String name)
 
void setProperty (String name, Object value) throws IllegalArgumentException
 
XMLInputFactory clone ()
 

Static Public Attributes

static final String IS_COALESCING = "javolution.xml.stream.isCoalescing"
 
static final String IS_VALIDATING = "javolution.xml.stream.isValidating"
 
static final String ENTITIES = "javolution.xml.stream.entities"
 

Package Functions

void recycle (XMLStreamReaderImpl reader)
 

Private Member Functions

XMLStreamReaderImpl newReader ()
 

Private Attributes

Map< String, String > _entities = null
 
FastTable< XMLStreamReaderImpl_recycled
 

Detailed Description

The default XML input factory implementation.

Definition at line 22 of file XMLInputFactoryImpl.java.

Member Function Documentation

◆ clone()

XMLInputFactory javolution.xml.internal.stream.XMLInputFactoryImpl.clone ( )

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

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 97 of file XMLInputFactoryImpl.java.

97  {
98  try {
99  XMLInputFactoryImpl clone = (XMLInputFactoryImpl) super.clone();
100  clone._recycled = new FastTable<XMLStreamReaderImpl>().shared();
101  return clone;
102  } catch (CloneNotSupportedException e) {
103  throw new Error();// Cannot happen since cloneable.
104  }
105  }

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

Here is the call graph for this function:

◆ createXMLStreamReader() [1/3]

XMLStreamReaderImpl javolution.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader ( InputStream  stream) throws XMLStreamException

Returns a XML stream reader for the specified input stream (encoding autodetected).

Parameters
streamthe input stream to read from.
Returns
a xml stream reader possibly recycled.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 28 of file XMLInputFactoryImpl.java.

29  {
30  XMLStreamReaderImpl xmlReader = newReader();
31  xmlReader.setInput(stream);
32  return xmlReader;
33  }

References javolution.xml.internal.stream.XMLInputFactoryImpl.newReader(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Here is the call graph for this function:

◆ createXMLStreamReader() [2/3]

XMLStreamReaderImpl javolution.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader ( InputStream  stream,
String  encoding 
) throws XMLStreamException

Returns a XML stream reader for the specified input stream using the specified encoding.

Parameters
streamthe input stream to read from.
encodingthe character encoding of the stream.
Returns
a xml stream reader possibly recycled.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 36 of file XMLInputFactoryImpl.java.

37  {
38  XMLStreamReaderImpl xmlReader = newReader();
39  xmlReader.setInput(stream, encoding);
40  return xmlReader;
41  }

References javolution.xml.internal.stream.XMLInputFactoryImpl.newReader(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Here is the call graph for this function:

◆ createXMLStreamReader() [3/3]

XMLStreamReaderImpl javolution.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader ( Reader  reader) throws XMLStreamException

Returns a XML stream reader for the specified I/O reader.

Parameters
readerthe XML data to read from.
Exceptions
XMLStreamException

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 44 of file XMLInputFactoryImpl.java.

45  {
46  XMLStreamReaderImpl xmlReader = newReader();
47  xmlReader.setInput(reader);
48  return xmlReader;
49  }

References javolution.xml.internal.stream.XMLInputFactoryImpl.newReader(), and javolution.xml.internal.stream.XMLStreamReaderImpl.setInput().

Here is the call graph for this function:

◆ getProperty()

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

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

Parameters
namethe name of the property (may not be null).
Returns
the value of the property.
Exceptions
IllegalArgumentExceptionif the property is not supported.

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 52 of file XMLInputFactoryImpl.java.

52  {
53  if (name.equals(IS_COALESCING)) {
54  return Boolean.TRUE;
55  } else if (name.equals(ENTITIES)) {
56  return _entities;
57  } else {
58  throw new IllegalArgumentException("Property: " + name
59  + " not supported");
60  }
61  }

References javolution.xml.internal.stream.XMLInputFactoryImpl._entities, javolution.xml.stream.XMLInputFactory.ENTITIES, and javolution.xml.stream.XMLInputFactory.IS_COALESCING.

◆ isPropertySupported()

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

Queries the set of properties that this factory supports.

Parameters
namethe name of the property.
Returns
true if the property is supported; false otherwise.

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 64 of file XMLInputFactoryImpl.java.

64  {
65  return name.equals(IS_COALESCING) || name.equals(ENTITIES);
66  }

References javolution.xml.stream.XMLInputFactory.ENTITIES, and javolution.xml.stream.XMLInputFactory.IS_COALESCING.

◆ newReader()

XMLStreamReaderImpl javolution.xml.internal.stream.XMLInputFactoryImpl.newReader ( )
private

Definition at line 87 of file XMLInputFactoryImpl.java.

87  {
88  XMLStreamReaderImpl xmlReader = _recycled.pollLast();
89  if (xmlReader == null) xmlReader = new XMLStreamReaderImpl(this);
90  if (_entities != null) {
91  xmlReader.setEntities(_entities);
92  }
93  return xmlReader;
94  }

References javolution.xml.internal.stream.XMLInputFactoryImpl._entities, javolution.xml.internal.stream.XMLInputFactoryImpl._recycled, and javolution.xml.internal.stream.XMLStreamReaderImpl.setEntities().

Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader().

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

◆ recycle()

void javolution.xml.internal.stream.XMLInputFactoryImpl.recycle ( XMLStreamReaderImpl  reader)
package

Recycles the specified instance.

Definition at line 83 of file XMLInputFactoryImpl.java.

83  {
84  _recycled.addLast(reader);
85  }

References javolution.xml.internal.stream.XMLInputFactoryImpl._recycled.

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

Here is the caller graph for this function:

◆ setProperty()

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

Allows the user to set specific feature/property on the underlying implementation. The underlying implementation is not required to support every setting of every property in the specification and may use IllegalArgumentException to signal that an unsupported property may not be set with the specified value.

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

Implements javolution.xml.stream.XMLInputFactory.

Definition at line 70 of file XMLInputFactoryImpl.java.

71  {
72  if (name.equals(IS_COALESCING)) {
73  // Do nothing, always coalescing.
74  } else if (name.equals(ENTITIES)) {
75  _entities = (Map<String, String>) value;
76  } else {
77  throw new IllegalArgumentException("Property: " + name
78  + " not supported");
79  }
80  }

References javolution.xml.internal.stream.XMLInputFactoryImpl._entities, javolution.xml.stream.XMLInputFactory.ENTITIES, and javolution.xml.stream.XMLInputFactory.IS_COALESCING.

Member Data Documentation

◆ _entities

Map<String, String> javolution.xml.internal.stream.XMLInputFactoryImpl._entities = null
private

◆ _recycled

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

Definition at line 24 of file XMLInputFactoryImpl.java.

Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.newReader(), and javolution.xml.internal.stream.XMLInputFactoryImpl.recycle().

◆ ENTITIES

final String javolution.xml.stream.XMLInputFactory.ENTITIES = "javolution.xml.stream.entities"
staticinherited

Property used to specify additional entities to be recognized by the readers (type: java.util.Map, default: null). For example:[code] FastMap<String, String> HTML_ENTITIES = new FastMap<String, String>(); HTML_ENTITIES.put("nbsp", " "); HTML_ENTITIES.put("copy", "©"); HTML_ENTITIES.put("eacute", "é"); ... XMLInputFactory factory = factoryRef.getService(); factory.setProperty(ENTITIES, HTML_ENTITIES); [/code]

Definition at line 80 of file XMLInputFactory.java.

Referenced by javolution.xml.internal.stream.XMLInputFactoryImpl.getProperty(), javolution.xml.internal.stream.XMLStreamReaderImpl.getProperty(), javolution.xml.internal.stream.XMLInputFactoryImpl.isPropertySupported(), and javolution.xml.internal.stream.XMLInputFactoryImpl.setProperty().

◆ IS_COALESCING

final String javolution.xml.stream.XMLInputFactory.IS_COALESCING = "javolution.xml.stream.isCoalescing"
staticinherited

◆ IS_VALIDATING

final String javolution.xml.stream.XMLInputFactory.IS_VALIDATING = "javolution.xml.stream.isValidating"
staticinherited

The property that requires the parser to validate the input data.

Definition at line 65 of file XMLInputFactory.java.


The documentation for this class was generated from the following file:
javolution.xml.stream.XMLInputFactory.clone
XMLInputFactory clone()
javolution.xml.stream.XMLInputFactory.IS_COALESCING
static final String IS_COALESCING
Definition: XMLInputFactory.java:60
javolution.xml.internal.stream.XMLInputFactoryImpl._entities
Map< String, String > _entities
Definition: XMLInputFactoryImpl.java:23
javolution.xml.internal.stream.XMLInputFactoryImpl.clone
XMLInputFactory clone()
Definition: XMLInputFactoryImpl.java:97
javolution.xml.internal.stream.XMLInputFactoryImpl._recycled
FastTable< XMLStreamReaderImpl > _recycled
Definition: XMLInputFactoryImpl.java:24
javolution.xml.internal.stream.XMLInputFactoryImpl.newReader
XMLStreamReaderImpl newReader()
Definition: XMLInputFactoryImpl.java:87
javolution.xml.stream.XMLInputFactory.ENTITIES
static final String ENTITIES
Definition: XMLInputFactory.java:80