Java Doc for DataEncoder.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » xml » 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 » Ajax » Laszlo 4.0.10 » org.openlaszlo.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openlaszlo.xml.DataEncoder

DataEncoder
public class DataEncoder implements org.xml.sax.ContentHandler(Code)
API to compile XML-like data sets to SWF bytecode format.

This class implements the SAX ContentHandler API, and could possibly be used directly with a SAX Parser, but is designed to be used manually as shown below.

Example usage:

 import org.xml.sax.helpers.AttributesImpl;
 // send simple row data as node with attributes
 InputStream getDataInputStream(Request req, Response resp) {
 Connection conn = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX + alias, null, null);
 Statement stmt = conn.createStatement();
 ResultSet resultset = stmt.executeQuery("SELECT NAME, AGE, ID FROM EMPLOYEES");
 AttributesImpl emptyAttr = new AttributesImpl();
 DataEncoder db = new DataEncoder();
 db.startDocument();
 db.startElement("results", emptyAttr);
 while (resultset.next()) {
 AttributesImpl attrs = new AttributesImpl();
 //Output the values as attributes
 attrs.addAttribute("", "name", "", "CDATA", resultset.getString("name"));
 attrs.addAttribute("", "age", "", "CDATA", resultset.getString("age"));
 attrs.addAttribute("", "id", "", "CDATA", resultset.getString("id"));
 db.startElement("row", attrs);
 db.endElement();
 }
 db.endElement();
 db.endDocument();
 OutputStream out = resp.getOutputStream();
 return db.getInputStream();
 }
 


Field Summary
 FlashBufferbody
    
 DataContextdc
    
 intmFlashVersion
    
 FlashBufferout
    
 Programprogram
    
 ProgramresultProgram
    

Constructor Summary
public  DataEncoder()
     Constructs an empty DataEncoder.
public  DataEncoder(int initsize)
     Constructs a DataEncoder with a buffer allocation size hint.

Method Summary
public  void_startElement(String localName)
     A lower level call than startElement(); attributes must be supplied by individual calls to addAttribute().
public  voidaddAttribute(String attrName, String attrVal)
     A low level call to add an attribute, must be preceded by call to _startElement() for a given element.
public  voidbuildFromDocument(Document doc)
    
public  voidbuildFromElement(Element e)
     Build from a DOM Element.
public  voidcharacters(char[] ch, int start, int length)
     Receive notification of character data.
public  voidcharacters(String text)
     Receive notification of string data.
public  voidendDocument()
     Receive notification of the end of a document.
public  voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
     Receive notification of the end of an element.
public  voidendElement()
     Receive notification of the end of an element.
public  voidendPrefixMapping(java.lang.String prefix)
     End the scope of a prefix-URI mapping.
 StringgetAttributeType(Attribute attr)
    
public  InputStreamgetInputStream()
     Get the compiled data swf program byte codes.
 StringgetQualifiedName(Attribute attr)
    
public  longgetSize()
     Return the size of the output object; only valid after endDocument DataEncoder.endDocument endDocument() has been called.
public  voidignorableWhitespace(char[] ch, int start, int length)
     Receive notification of ignorable whitespace in element content.
public  voidprocessingInstruction(java.lang.String target, java.lang.String data)
     Receive notification of a processing instruction.
public  voidsetDocumentLocator(Locator locator)
     Receive an object for locating the origin of SAX document events.
public  voidskippedEntity(java.lang.String name)
     Receive notification of a skipped entity.
public  voidstartDocument()
     Receive notification of the beginning of a document.
public  voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, Attributes atts)
     Receive notification of the beginning of an element.
public  voidstartElement(java.lang.String localName, Attributes atts)
     Receive notification of the beginning of an element.
Parameters:
  localName - the local name (without prefix), or the empty string ifNamespace processing is not being performed.
Parameters:
  atts - the attributes attached to the element.
public  voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)
     Begin the scope of a prefix-URI Namespace mapping.

Field Detail
body
FlashBuffer body(Code)



dc
DataContext dc(Code)
State vars



mFlashVersion
int mFlashVersion(Code)



out
FlashBuffer out(Code)



program
Program program(Code)



resultProgram
Program resultProgram(Code)




Constructor Detail
DataEncoder
public DataEncoder()(Code)
Constructs an empty DataEncoder.



DataEncoder
public DataEncoder(int initsize)(Code)
Constructs a DataEncoder with a buffer allocation size hint.
Parameters:
  initsize - hint to allocate buffer size large enough to hold output.




Method Detail
_startElement
public void _startElement(String localName)(Code)
A lower level call than startElement(); attributes must be supplied by individual calls to addAttribute(). This method is unimplemented.
Parameters:
  localName - the element name.



addAttribute
public void addAttribute(String attrName, String attrVal)(Code)
A low level call to add an attribute, must be preceded by call to _startElement() for a given element. This method is unimplemented.



buildFromDocument
public void buildFromDocument(Document doc) throws DataEncoderException(Code)
Parse a DOM Document and pass it to DataEncoder via JDOM SAXOutputter
Parameters:
  doc - DOM Document to build.
throws:
  DataCompilerException - if there was a problem compiling the Document.



buildFromElement
public void buildFromElement(Element e)(Code)
Build from a DOM Element.
Parameters:
  e - DOM Element.



characters
public void characters(char[] ch, int start, int length)(Code)
Receive notification of character data.
Parameters:
  ch - the characters from the XML document.
Parameters:
  start - the start position in the array.
Parameters:
  length - the number of characters to read from the array.
See Also:   DataEncoder.characters(String)
See Also:    characters(String)



characters
public void characters(String text)(Code)
Receive notification of string data.
Parameters:
  text - the string from the XML document.
See Also:   DataEncoder.characters(char[],int,int)
See Also:    characters(char[], int, int)



endDocument
public void endDocument()(Code)
Receive notification of the end of a document.
See Also:   DataEncoder.startDocument()
See Also:    startDocument()



endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)(Code)
Receive notification of the end of an element. This method is equivalent to calling DataEncoder.endElement() endElement() -- the input parameters are ignored.
Parameters:
  uri - the Namespace URI, or the empty string if the element has noNamespace URI or if Namespace processing is not being performed.
Parameters:
  localName - the local name (without prefix), or the empty string ifNamespace processing is not being performed.
Parameters:
  qName - the qualified XML 1.0 name (with prefix), or the emptystring if qualified names are not available.
See Also:   DataEncoder.endElement()
See Also:    endElement()



endElement
public void endElement()(Code)
Receive notification of the end of an element.
See Also:   DataEncoder.endElement(String,String,String)
See Also:    endElement(String,String,String)



endPrefixMapping
public void endPrefixMapping(java.lang.String prefix)(Code)
End the scope of a prefix-URI mapping. This method is unimplemented.
Parameters:
  prefix - the prefix that was being mapped.



getAttributeType
String getAttributeType(Attribute attr)(Code)



getInputStream
public InputStream getInputStream() throws IOException(Code)
Get the compiled data swf program byte codes. Only call this after you have called DataEncoder.endDocument endDocument() . input stream containing the compiled SWF data program; only valid after DataEncoder.endDocument endDocument() has been called. Must not be calledbefore DataEncoder.endDocument endDocument().



getQualifiedName
String getQualifiedName(Attribute attr)(Code)



getSize
public long getSize() throws IOException(Code)
Return the size of the output object; only valid after endDocument DataEncoder.endDocument endDocument() has been called. Must not be called before DataEncoder.endDocument endDocument() . long representing the size



ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length)(Code)
Receive notification of ignorable whitespace in element content. This method is unimplemented.
Parameters:
  ch - the characters from the XML document.
Parameters:
  start - the start position in the array.
Parameters:
  length - the number of characters to read from the array.



processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data)(Code)
Receive notification of a processing instruction. This method is unimplemented.
Parameters:
  target - the processing instruction target.
Parameters:
  data - the processing instruction data, or null if none wassupplied. The data does not include any whitespace separating it from thetarget.



setDocumentLocator
public void setDocumentLocator(Locator locator)(Code)
Receive an object for locating the origin of SAX document events. This method is unimplemented.
Parameters:
  locator - an object that can return the location of any SAX documentevent.



skippedEntity
public void skippedEntity(java.lang.String name)(Code)
Receive notification of a skipped entity. This method is unimplemented.
Parameters:
  name - the name of the skipped entity. If it is a parameter entity,the name will begin with '%', and if it is the external DTD subset, itwill be the string "[dtd]".



startDocument
public void startDocument()(Code)
Receive notification of the beginning of a document.
See Also:   DataEncoder.endDocument()
See Also:    endDocument()



startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, Attributes atts)(Code)
Receive notification of the beginning of an element. This method is equivalent to calling DataEncoder.startElement(String,Attributes)startElement(String, Attributes) -- the uri and qName parameters are ignored.
Parameters:
  uri - the Namespace URI, or the empty string if the element has noNamespace URI or if Namespace processing is not being performed.
Parameters:
  localName - the local name (without prefix), or the empty string ifNamespace processing is not being performed.
Parameters:
  qName - the qualified name (with prefix), or the empty string ifqualified names are not available.
Parameters:
  atts - the attributes attached to the element. If there are noattributes, it shall be an empty Attributes object.
See Also:   DataEncoder.startElement(String,Attributes)
See Also:    startElement(String, Attributes)



startElement
public void startElement(java.lang.String localName, Attributes atts)(Code)
Receive notification of the beginning of an element.
Parameters:
  localName - the local name (without prefix), or the empty string ifNamespace processing is not being performed.
Parameters:
  atts - the attributes attached to the element. If there are noattributes, it shall be an empty Attributes object.
See Also:   DataEncoder.startElement(String,String,String,Attributes)
See Also:   startElement(String, String, String, Attributes)



startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri)(Code)
Begin the scope of a prefix-URI Namespace mapping. This method is unimplemented.
Parameters:
  prefix - the Namespace prefix being declared.
Parameters:
  uri - the Namespace URI the prefix is mapped to.



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.