|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttwitter4j.TwitterBase
twitter4j.TwitterStream
public class TwitterStream
A java reporesentation of the Twitter Streaming API
Note that this class is NOT compatible with Google App Engine as GAE is not capable of handling requests longer than 30 seconds.
| Nested Class Summary | |
|---|---|
(package private) class |
TwitterStream.StreamHandlingThread
|
| Field Summary | |
|---|---|
private TwitterStream.StreamHandlingThread |
handler
|
private HttpClientWrapper |
http
|
private static Logger |
logger
|
private int |
retryPerMinutes
|
private static long |
serialVersionUID
|
private StatusListener |
statusListener
|
| Fields inherited from class twitter4j.TwitterBase |
|---|
auth, conf |
| Constructor Summary | |
|---|---|
TwitterStream()
Deprecated. use new TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(Configuration conf,
Authorization auth,
StatusListener listener)
|
|
TwitterStream(java.lang.String screenName,
java.lang.String password)
Deprecated. use new TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(java.lang.String screenName,
java.lang.String password,
StatusListener listener)
Deprecated. use new TwitterStreamFactory.getInstance() instead. |
|
| Method Summary | |
|---|---|
void |
cleanup()
|
void |
filter(int count,
int[] follow,
java.lang.String[] track)
See birddog above. |
void |
firehose(int count)
Starts listening on all public statuses. |
StatusStream |
getFilterStream(int count,
int[] follow,
java.lang.String[] track)
Returns stream of public statuses that match one or more filter predicates. |
StatusStream |
getFirehoseStream(int count)
Returns a status stream of all public statuses. |
StatusStream |
getRetweetStream()
Returns a stream of all retweets. |
StatusStream |
getSampleStream()
Returns a stream of random sample of all public statuses. |
void |
retweet()
Starts listening on all retweets. |
void |
sample()
Starts listening on random sample of all public statuses. |
void |
setStatusListener(StatusListener statusListener)
|
private void |
startHandler(TwitterStream.StreamHandlingThread handler)
|
private java.lang.String |
toFollowString(int[] follows)
|
private java.lang.String |
toTrackString(java.lang.String[] keywords)
|
| Methods inherited from class twitter4j.TwitterBase |
|---|
ensureAuthorizationEnabled, ensureBasicEnabled, ensureBasicNotEnabled, equals, getAuthorization, hashCode, isBasicAuthEnabled, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final HttpClientWrapper http
private static final Logger logger
private StatusListener statusListener
private TwitterStream.StreamHandlingThread handler
private int retryPerMinutes
private static final long serialVersionUID
| Constructor Detail |
|---|
public TwitterStream()
public TwitterStream(java.lang.String screenName,
java.lang.String password)
screenName - screen namepassword - password
public TwitterStream(java.lang.String screenName,
java.lang.String password,
StatusListener listener)
screenName - screen namepassword - passwordlistener - listener
TwitterStream(Configuration conf,
Authorization auth,
StatusListener listener)
| Method Detail |
|---|
public void firehose(int count)
throws TwitterException
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - firehose
public StatusStream getFirehoseStream(int count)
throws TwitterException
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - firehose
public void retweet()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - retweet
public StatusStream getRetweetStream()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - firehose
public void sample()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - sample
public StatusStream getSampleStream()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - Sampling
public void filter(int count,
int[] follow,
java.lang.String[] track)
throws TwitterException
count - Indicates the number of previous statuses to stream before transitioning to the live stream.follow - Specifies the users, by ID, to receive public tweets from.track - Specifies keywords to track.
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - filter
public StatusStream getFilterStream(int count,
int[] follow,
java.lang.String[] track)
throws TwitterException
follow - Specifies the users, by ID, to receive public tweets from.
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - filterprivate java.lang.String toFollowString(int[] follows)
private java.lang.String toTrackString(java.lang.String[] keywords)
private void startHandler(TwitterStream.StreamHandlingThread handler)
throws TwitterException
TwitterExceptionpublic void cleanup()
public void setStatusListener(StatusListener statusListener)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||