RiverRat  - An MIT iCampus project http://web.mit.edu/riverrat/

Main Page | Software Documentation | Hardware Documentation | People | Contact | Wiki

Main Page | Class Hierarchy | Class List | File List | Class Members

riverrat.RiverRatListener Class Reference

Finished prototype - Spawns a new thread and opens up a connection to a Radio Server pushing data. More...

List of all members.

Public Member Functions

 RiverRatListener ()
 Default constructor.

 RiverRatListener (ContentHandler somehandler)
 Constructor.

 RiverRatListener (ContentHandler somehandler, String connect_host, int connect_port)
 Constructor.

void startElement (String uri, String localpart, String rawname, Attributes attrs) throws SAXException
 This implements part of the ContentHandler interface, and is provided only for debugging.

void endElement (String uri, String localpart, String rawname) throws SAXException
 This implements part of the ContentHandler interface, and is provided only for debugging.

void startDocument ()
 This implements part of the ContentHandler interface, and is provided only for debugging.

void endDocument ()
 This implements part of the ContentHandler interface, and is provided only for debugging.

void warning (SAXParseException ex) throws SAXException
 These methods implement the ErrorHandler interface, and are required.

void error (SAXParseException ex) throws SAXException
 These methods implement the ErrorHandler interface, and are required.

void fatalError (SAXParseException ex) throws SAXException
 These methods implement the ErrorHandler interface, and are required.

void run ()
 Lights, camera, action.


Static Public Member Functions

void main (String args[])
 Test case.


Static Package Attributes

int port = 8080
 Port to connect on by default.

String host = "localhost"
 Host to connect to by default.

final boolean DELAY_INPUT = false
 Used for testing purposes, this uses the DelayedInputStream class to slow the data stream down and read chunks at a time.

final boolean DEBUG = false
 Debugging.

DefaultHandler defaulthandler
ContentHandler contenthandler
PrintWriter out
XMLReader parser
Socket socket
InputStream stream
InputSource source


Detailed Description

Finished prototype - Spawns a new thread and opens up a connection to a Radio Server pushing data.

Definition at line 22 of file RiverRatListener.java.


Constructor & Destructor Documentation

riverrat.RiverRatListener.RiverRatListener  ) 
 

Default constructor.

Doesn't do anything besides make the object, and uses some debugging functions to handle XML parser callbacks.

Definition at line 51 of file RiverRatListener.java.

Referenced by riverrat.RiverRatListener.main(), and riverrat.RiverRatListener.run().

riverrat.RiverRatListener.RiverRatListener ContentHandler  somehandler  ) 
 

Constructor.

Takes a class implementing the ContentHandler interface and sets the ContentHandler of the XML data stream pulled by the listener to the given class. The XML callbacks are sent to the that class. When this constructor is used, the default host ("localhost") and the default port (8080) are used to open the TCP connection.

Parameters:
somehandler ContentHandler to be used for data handling

Definition at line 64 of file RiverRatListener.java.

riverrat.RiverRatListener.RiverRatListener ContentHandler  somehandler,
String  connect_host,
int  connect_port
 

Constructor.

Takes a ContentHandler class and a server to connect to. The String connect_host specifies the hostname to pull data from, the int connect_port specifies the port to open the TCP connection on.

Parameters:
somehandler ContentHandler to be used for data handling connect_host String with hostname of server connect_port int with port to connect on

Definition at line 78 of file RiverRatListener.java.


Member Function Documentation

void riverrat.RiverRatListener.endDocument  ) 
 

This implements part of the ContentHandler interface, and is provided only for debugging.

These methods simply print the XML callbacks with raw names and attributes in a semi-human-readable form.

Definition at line 123 of file RiverRatListener.java.

void riverrat.RiverRatListener.endElement String  uri,
String  localpart,
String  rawname
throws SAXException
 

This implements part of the ContentHandler interface, and is provided only for debugging.

These methods simply print the XML callbacks with raw names and attributes in a semi-human-readable form.

Definition at line 103 of file RiverRatListener.java.

void riverrat.RiverRatListener.error SAXParseException  ex  )  throws SAXException
 

These methods implement the ErrorHandler interface, and are required.

They are used for error handling while parsing with an external class.

Definition at line 141 of file RiverRatListener.java.

void riverrat.RiverRatListener.fatalError SAXParseException  ex  )  throws SAXException
 

These methods implement the ErrorHandler interface, and are required.

They are used for error handling while parsing with an external class.

Definition at line 150 of file RiverRatListener.java.

void riverrat.RiverRatListener.main String  args[]  )  [static]
 

Test case.

This starts a new RiverRatListener using some testing functions to print XML elements and attributes.

Definition at line 225 of file RiverRatListener.java.

References riverrat.RiverRatListener.RiverRatListener().

void riverrat.RiverRatListener.run  ) 
 

Lights, camera, action.

This is where the cool stuff happens. When the a RiverRatListener is made into a thread, this gets run. It initializes the parser, opens a TCP connection, and runs the XML data through the parser. The parser then calls the required methods in the ContentHandler class being used for XML parsing callbacks.

Definition at line 162 of file RiverRatListener.java.

References riverrat.RiverRatListener.DELAY_INPUT, and riverrat.RiverRatListener.RiverRatListener().

void riverrat.RiverRatListener.startDocument  ) 
 

This implements part of the ContentHandler interface, and is provided only for debugging.

These methods simply print the XML callbacks with raw names and attributes in a semi-human-readable form.

Definition at line 113 of file RiverRatListener.java.

void riverrat.RiverRatListener.startElement String  uri,
String  localpart,
String  rawname,
Attributes  attrs
throws SAXException
 

This implements part of the ContentHandler interface, and is provided only for debugging.

These methods simply print the XML callbacks with raw names and attributes in a semi-human-readable form.

Definition at line 89 of file RiverRatListener.java.

void riverrat.RiverRatListener.warning SAXParseException  ex  )  throws SAXException
 

These methods implement the ErrorHandler interface, and are required.

They are used for error handling while parsing with an external class.

Definition at line 132 of file RiverRatListener.java.


Member Data Documentation

final boolean riverrat.RiverRatListener.DELAY_INPUT = false [static, package]
 

Used for testing purposes, this uses the DelayedInputStream class to slow the data stream down and read chunks at a time.

Definition at line 33 of file RiverRatListener.java.

Referenced by riverrat.RiverRatListener.run().


The documentation for this class was generated from the following file:  

Brought to you by the RiverRat team.