twitter4j.examples
Class StreamingExample

java.lang.Object
  extended by twitter4j.examples.StreamingExample
All Implemented Interfaces:
StatusListener

public class StreamingExample
extends java.lang.Object
implements StatusListener

This is a code example of Twitter4J Streaming API support.
Usage: java twitter4j.examples.StreamingExample TwitterID TwitterPassword

Author:
Yusuke Yamamoto - yusuke at mac.com

Field Summary
(package private)  TwitterStream twitterStream
           
 
Constructor Summary
StreamingExample(java.lang.String id, java.lang.String password)
           
 
Method Summary
static void main(java.lang.String[] args)
          Main entry for this application.
 void onDeletionNotice(StatusDeletionNotice statusDeletionNotice)
          Called upon deletionNotice notices.
 void onException(java.lang.Exception ex)
           
 void onStatus(Status status)
           
 void onTrackLimitationNotice(int numberOfLimitedStatuses)
          This notice will be sent each time a limited stream becomes unlimited.
If this number is high and or rapidly increasing, it is an indication that your predicate is too broad, and you should consider a predicate with higher selectivity.
private  void startConsuming()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

twitterStream

TwitterStream twitterStream
Constructor Detail

StreamingExample

StreamingExample(java.lang.String id,
                 java.lang.String password)
Method Detail

main

public static void main(java.lang.String[] args)
                 throws TwitterException
Main entry for this application.

Parameters:
args - String[] TwitterID TwitterPassword
Throws:
TwitterException

startConsuming

private void startConsuming()
                     throws TwitterException
Throws:
TwitterException

onStatus

public void onStatus(Status status)
Specified by:
onStatus in interface StatusListener

onDeletionNotice

public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice)
Description copied from interface: StatusListener
Called upon deletionNotice notices. Clients are urged to honor deletionNotice requests and discard deleted statuses immediately. At times, status deletionNotice messages may arrive before the status. Even in this case, the late arriving status should be deleted from your backing store.

Specified by:
onDeletionNotice in interface StatusListener
Parameters:
statusDeletionNotice - the deletionNotice notice
See Also:
Streaming API Documentation - Parsing Responses

onTrackLimitationNotice

public void onTrackLimitationNotice(int numberOfLimitedStatuses)
Description copied from interface: StatusListener
This notice will be sent each time a limited stream becomes unlimited.
If this number is high and or rapidly increasing, it is an indication that your predicate is too broad, and you should consider a predicate with higher selectivity.

Specified by:
onTrackLimitationNotice in interface StatusListener
Parameters:
numberOfLimitedStatuses - an enumeration of statuses that matched the track predicate but were administratively limited.
See Also:
Streaming API Documentation - Track Limiting, - Parsing Responses, Twitter Development Talk - Track API Limit message meaning

onException

public void onException(java.lang.Exception ex)
Specified by:
onException in interface StatusListener