Java Doc for XMLStreamReaderImpl.java in  » Development » Javolution » javolution » xml » stream » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Javolution » javolution.xml.stream 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javolution.xml.stream.XMLStreamReaderImpl

XMLStreamReaderImpl
final public class XMLStreamReaderImpl implements XMLStreamReader,Reusable(Code)

This class represents a javolution.lang.Reusable reusable implementation of XMLStreamWriter .

Except for the types being used ( CharArray CharArray / CharSequence CharSequence instead of String ) the parsing behavior is about the same as for the standard javax.xml.stream.XMLStreamReader (although several times faster).

The CharArray CharArray instances returned by this reader supports fast primitive conversions as illustrated below:[code] // Creates reader for an input sream with unknown encoding. XMLStreamReaderImpl xmlReader = new XMLStreamReaderImpl().setInput(inputStream); // Parses. for (int e=xmlReader.next(); e != XMLStreamConstants.END_DOCUMENT; e = xmlReader.next()) { switch (e) { // Event. case XMLStreamConstants.START_ELEMENT: if (xmlReader.getLocalName().equals("Time")) { // Reads primitive types (int) attributes directly. int hour = xmlReader.getAttributeValue("hour").toInt(); int minute = xmlReader.getAttributeValue("minute").toInt(); int second = xmlReader.getAttributeValue("second").toInt(); ... } ... break; } } // Closes reader, it is automatically reset() and can be reused! xmlReader.close(); [/code]

This reader returns all contiguous character data in a single chunk (always coalescing). It is non-validating (DTD is returned unparsed). Although, users may define custom entities mapping using the XMLStreamReaderImpl.setEntities method (e.g. after parsing/resolving external entities).


author:
   Jean-Marie Dautelle
version:
   4.0, September 4, 2006


Field Summary
final static  String[]NAMES_OF_EVENTS
     Holds the textual representation for events.
final static  intREADER_BUFFER_CAPACITY
     Holds the reader buffer capacity.
 boolean_charactersPending
     Indicates if characters are pending for potential coalescing.
 ObjectFactory_objectFactory
     Holds object factory when factory-produced.
 CharArray_prolog
     Holds the prolog if any.

Constructor Summary
public  XMLStreamReaderImpl()
     Default constructor.

Method Summary
public  voidclose()
    
public  intgetAttributeCount()
    
public  CharArraygetAttributeLocalName(int index)
    
public  CharArraygetAttributeNamespace(int index)
    
public  CharArraygetAttributePrefix(int index)
    
public  CharArraygetAttributeType(int index)
    
public  CharArraygetAttributeValue(CharSequence uri, CharSequence localName)
    
public  CharArraygetAttributeValue(int index)
    
public  AttributesgetAttributes()
     Returns the current attributes (SAX2-Like).
public  CharArraygetCharacterEncodingScheme()
    
public  intgetDepth()
     Returns the current depth of the element.
public  CharArraygetElementText()
    
public  StringgetEncoding()
    
public  intgetEventType()
    
public  CharArraygetLocalName()
    
public  LocationgetLocation()
    
public  NamespaceContextgetNamespaceContext()
    
public  intgetNamespaceCount()
    
public  CharArraygetNamespacePrefix(int index)
    
public  CharArraygetNamespaceURI(CharSequence prefix)
    
public  CharArraygetNamespaceURI(int index)
    
public  CharArraygetNamespaceURI()
    
public  CharArraygetPIData()
    
public  CharArraygetPITarget()
    
public  CharArraygetPrefix()
    
public  ObjectgetProperty(String name)
    
public  CharArraygetQName()
     Returns the qualified name of the current event.
public  CharArraygetText()
    
public  char[]getTextCharacters()
    
public  intgetTextCharacters(int sourceStart, char[] target, int targetStart, int length)
    
public  intgetTextLength()
    
public  intgetTextStart()
    
public  CharArraygetVersion()
    
public  booleanhasName()
    
public  booleanhasNext()
    
public  booleanhasText()
    
public  booleanisAttributeSpecified(int index)
    
public  booleanisCharacters()
    
public  booleanisEndElement()
    
public  booleanisStandalone()
    
public  booleanisStartElement()
    
public  booleanisWhiteSpace()
    
public  intnext()
    
public  intnextTag()
    
public  voidrequire(int type, CharSequence namespaceURI, CharSequence localName)
    
public  voidreset()
    
public  voidsetEntities(Map entities)
     Defines a custom entities to replacement text mapping for this reader. For example:[code] FastMap HTML_ENTITIES = new FastMap(); HTML_ENTITIES.put("nbsp", " "); HTML_ENTITIES.put("copy", "©"); HTML_ENTITIES.put("eacute", "é"); ... XMLStreamReaderImpl reader = new XMLStreamReaderImpl(); reader.setEntities(HTML_ENTITIES); [/code] The entities mapping may be changed dynamically (e.g.
public  voidsetInput(InputStream in)
     Sets the input stream source for this XML stream reader (encoding retrieved from XML prolog if any).
public  voidsetInput(InputStream in, String encoding)
     Sets the input stream source and encoding for this XML stream reader.
public  voidsetInput(Reader reader)
     Sets the reader input source for this XML stream reader.
public  booleanstandaloneSet()
    
public  StringtoString()
     Returns the textual representation of this reader current state.

Field Detail
NAMES_OF_EVENTS
final static String[] NAMES_OF_EVENTS(Code)
Holds the textual representation for events.



READER_BUFFER_CAPACITY
final static int READER_BUFFER_CAPACITY(Code)
Holds the reader buffer capacity.



_charactersPending
boolean _charactersPending(Code)
Indicates if characters are pending for potential coalescing.



_objectFactory
ObjectFactory _objectFactory(Code)
Holds object factory when factory-produced.



_prolog
CharArray _prolog(Code)
Holds the prolog if any.




Constructor Detail
XMLStreamReaderImpl
public XMLStreamReaderImpl()(Code)
Default constructor.




Method Detail
close
public void close() throws XMLStreamException(Code)



getAttributeCount
public int getAttributeCount()(Code)



getAttributeLocalName
public CharArray getAttributeLocalName(int index)(Code)



getAttributeNamespace
public CharArray getAttributeNamespace(int index)(Code)



getAttributePrefix
public CharArray getAttributePrefix(int index)(Code)



getAttributeType
public CharArray getAttributeType(int index)(Code)



getAttributeValue
public CharArray getAttributeValue(CharSequence uri, CharSequence localName)(Code)



getAttributeValue
public CharArray getAttributeValue(int index)(Code)



getAttributes
public Attributes getAttributes()(Code)
Returns the current attributes (SAX2-Like). returns the number of attributes.
throws:
  IllegalStateException - if not a START_ELEMENT.



getCharacterEncodingScheme
public CharArray getCharacterEncodingScheme()(Code)



getDepth
public int getDepth()(Code)
Returns the current depth of the element. Outside the root element, the depth is 0. The depth is incremented by 1 when a start tag is reached. The depth is decremented AFTER the end tag event was observed. [code] 0 1 sometext 1 2 2 1 0 [/code] the nesting depth.



getElementText
public CharArray getElementText() throws XMLStreamException(Code)



getEncoding
public String getEncoding()(Code)



getEventType
public int getEventType()(Code)



getLocalName
public CharArray getLocalName()(Code)



getLocation
public Location getLocation()(Code)



getNamespaceContext
public NamespaceContext getNamespaceContext()(Code)



getNamespaceCount
public int getNamespaceCount()(Code)



getNamespacePrefix
public CharArray getNamespacePrefix(int index)(Code)



getNamespaceURI
public CharArray getNamespaceURI(CharSequence prefix)(Code)



getNamespaceURI
public CharArray getNamespaceURI(int index)(Code)



getNamespaceURI
public CharArray getNamespaceURI()(Code)



getPIData
public CharArray getPIData()(Code)



getPITarget
public CharArray getPITarget()(Code)



getPrefix
public CharArray getPrefix()(Code)



getProperty
public Object getProperty(String name) throws IllegalArgumentException(Code)



getQName
public CharArray getQName()(Code)
Returns the qualified name of the current event. the qualified name.
throws:
  IllegalStateException - if this not a START_ELEMENT or END_ELEMENT.



getText
public CharArray getText()(Code)



getTextCharacters
public char[] getTextCharacters()(Code)



getTextCharacters
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException(Code)



getTextLength
public int getTextLength()(Code)



getTextStart
public int getTextStart()(Code)



getVersion
public CharArray getVersion()(Code)



hasName
public boolean hasName()(Code)



hasNext
public boolean hasNext() throws XMLStreamException(Code)



hasText
public boolean hasText()(Code)



isAttributeSpecified
public boolean isAttributeSpecified(int index)(Code)



isCharacters
public boolean isCharacters()(Code)



isEndElement
public boolean isEndElement()(Code)



isStandalone
public boolean isStandalone()(Code)



isStartElement
public boolean isStartElement()(Code)



isWhiteSpace
public boolean isWhiteSpace()(Code)



next
public int next() throws XMLStreamException(Code)



nextTag
public int nextTag() throws XMLStreamException(Code)



require
public void require(int type, CharSequence namespaceURI, CharSequence localName) throws XMLStreamException(Code)



reset
public void reset()(Code)



setEntities
public void setEntities(Map entities)(Code)
Defines a custom entities to replacement text mapping for this reader. For example:[code] FastMap HTML_ENTITIES = new FastMap(); HTML_ENTITIES.put("nbsp", " "); HTML_ENTITIES.put("copy", "©"); HTML_ENTITIES.put("eacute", "é"); ... XMLStreamReaderImpl reader = new XMLStreamReaderImpl(); reader.setEntities(HTML_ENTITIES); [/code] The entities mapping may be changed dynamically (e.g. after reading the DTD and all external entities references are resolved).
Parameters:
  entities - the entities to replacement texts mapping (both must be CharSequence instances).



setInput
public void setInput(InputStream in) throws XMLStreamException(Code)
Sets the input stream source for this XML stream reader (encoding retrieved from XML prolog if any).
Parameters:
  in - the input source with unknown encoding.



setInput
public void setInput(InputStream in, String encoding) throws XMLStreamException(Code)
Sets the input stream source and encoding for this XML stream reader.
Parameters:
  in - the input source.
Parameters:
  encoding - the associated encoding.



setInput
public void setInput(Reader reader) throws XMLStreamException(Code)
Sets the reader input source for this XML stream reader. This method reads the prolog (if any).
Parameters:
  reader - the input source reader.
See Also:   javolution.io.UTF8StreamReader
See Also:   javolution.io.UTF8ByteBufferReader
See Also:   javolution.io.CharSequenceReader



standaloneSet
public boolean standaloneSet()(Code)



toString
public String toString()(Code)
Returns the textual representation of this reader current state. the textual representation of the current state.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.