|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttwitter4j.TwitterStream
public final class TwitterStream
A java representation of the Streaming API: Methods
Note that this class is NOT compatible with Google App Engine as GAE is not capable of handling requests longer than 30 seconds.
| Field Summary |
|---|
| Fields inherited from interface twitter4j.internal.http.HttpResponseCode |
|---|
BAD_GATEWAY, BAD_REQUEST, ENHANCE_YOUR_CLAIM, FORBIDDEN, FOUND, INTERNAL_SERVER_ERROR, MULTIPLE_CHOICES, NOT_ACCEPTABLE, NOT_FOUND, NOT_MODIFIED, OK, SERVICE_UNAVAILABLE, UNAUTHORIZED |
| Constructor Summary | |
|---|---|
TwitterStream()
Deprecated. use TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(java.lang.String screenName,
java.lang.String password)
Deprecated. use TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(java.lang.String screenName,
java.lang.String password,
twitter4j.StreamListener listener)
Deprecated. use TwitterStreamFactory.getInstance() instead. |
|
| Method Summary | |
|---|---|
void |
addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
Adds a ConnectionLifeCycleListener |
void |
addListener(SiteStreamsListener listener)
|
void |
addListener(StatusListener listener)
|
void |
addListener(UserStreamListener listener)
|
void |
addStatusListener(StatusListener statusListener)
Deprecated. use addListener(StatusListener) instead. |
void |
addUserStreamListener(UserStreamListener userStreamListener)
Deprecated. use addListener(UserStreamListener) instead. |
void |
cleanup()
Deprecated. use #cleanUp instead |
void |
cleanUp()
shutdown internal stream consuming thread |
boolean |
equals(java.lang.Object o)
|
void |
filter(FilterQuery query)
Start consuming public statuses that match one or more filter predicates. |
void |
filter(int count,
int[] follow,
java.lang.String[] track)
Deprecated. use filter(FilterQuery) instead |
void |
firehose(int count)
Starts listening on all public statuses. |
Authorization |
getAuthorization()
Returns the authorization scheme for this instance. The returned type will be either of BasicAuthorization, OAuthAuthorization, or NullAuthorization |
Configuration |
getConfiguration()
Returns the configuration associated with this instance |
StatusStream |
getFilterStream(FilterQuery query)
Returns public statuses that match one or more filter predicates. |
StatusStream |
getFilterStream(int count,
int[] follow,
java.lang.String[] track)
Deprecated. use getFilterStream(FilterQuery) instead |
StatusStream |
getFirehoseStream(int count)
Returns a status stream of all public statuses. |
StatusStream |
getLinksStream(int count)
Returns a status stream of all public statuses containing links. |
AccessToken |
getOAuthAccessToken()
Returns an access token associated with this instance. If no access token is associated with this instance, this will retrieve a new access token. |
AccessToken |
getOAuthAccessToken(RequestToken requestToken)
Retrieves an access token associated with the supplied request token and sets userId. |
AccessToken |
getOAuthAccessToken(RequestToken requestToken,
java.lang.String oauthVerifier)
Retrieves an access token associated with the supplied request token and sets userId. |
AccessToken |
getOAuthAccessToken(java.lang.String oauthVerifier)
Retrieves an access token. |
AccessToken |
getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
Retrieves an access token associated with the supplied screen name and password using xAuth. In order to get access acquire AccessToken using xAuth, you must apply by sending an email to api@twitter.com — all other applications will receive an HTTP 401 error. |
AccessToken |
getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret,
java.lang.String pin)
Retrieves an access token associated with the supplied request token. |
RequestToken |
getOAuthRequestToken()
Retrieves a request token |
RequestToken |
getOAuthRequestToken(java.lang.String callbackUrl)
Retrieves a request token |
StatusStream |
getRetweetStream()
Returns a stream of all retweets. |
StatusStream |
getSampleStream()
Returns a stream of random sample of all public statuses. |
UserStream |
getUserStream()
User Streams provides real-time updates of all data needed to update a desktop application display. |
UserStream |
getUserStream(java.lang.String[] track)
User Streams provides real-time updates of all data needed to update a desktop application display. |
int |
hashCode()
|
void |
httpResponseReceived(twitter4j.internal.http.HttpResponseEvent event)
|
boolean |
isBasicAuthEnabled()
tests if the instance is authenticated by Basic |
boolean |
isOAuthEnabled()
tests if the instance is authenticated by Basic |
void |
links(int count)
Starts listening on all public statuses containing links. |
void |
retweet()
Starts listening on all retweets. |
void |
sample()
Starts listening on random sample of all public statuses. |
void |
setOAuthAccessToken(AccessToken accessToken)
Sets the access token |
void |
setOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
Deprecated. Use TwitterFactory.getInstance(twitter4j.http.Authorization) instead |
void |
setOAuthConsumer(java.lang.String consumerKey,
java.lang.String consumerSecret)
sets the OAuth consumer key and consumer secret |
void |
setRateLimitStatusListener(RateLimitStatusListener listener)
Registers a RateLimitStatusListener for account associated rate limits |
void |
setStatusListener(StatusListener listener)
Deprecated. use addListener(StatusListener) instead. |
void |
setUserStreamListener(UserStreamListener listener)
Deprecated. use addListener(UserStreamListener) instead. |
void |
shutdown()
Shuts down internal dispatcher thread used by site stream. |
void |
site(boolean withFollowings,
int[] follow)
Site Streams, a new feature on the Streaming API, is now available for beta testing. |
void |
stream(java.lang.String relativeUrl,
int count,
boolean handleUserStream)
Deprecated. |
java.lang.String |
toString()
|
void |
user()
User Streams provides real-time updates of all data needed to update a desktop application display. |
void |
user(java.lang.String[] track)
User Streams provides real-time updates of all data needed to update a desktop application display. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TwitterStream()
TwitterStreamFactory.getInstance() instead.
public TwitterStream(java.lang.String screenName,
java.lang.String password)
TwitterStreamFactory.getInstance() instead.
screenName - screen namepassword - password
public TwitterStream(java.lang.String screenName,
java.lang.String password,
twitter4j.StreamListener listener)
TwitterStreamFactory.getInstance() instead.
screenName - screen namepassword - passwordlistener - listener| Method Detail |
|---|
public void firehose(int count)
count - Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream,
Streaming API: Methods statuses/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,
Streaming API: Methods statuses/firehosepublic void links(int count)
count - Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream,
Streaming API: Methods statuses/links
public StatusStream getLinksStream(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,
Streaming API: Methods statuses/links
public void stream(java.lang.String relativeUrl,
int count,
boolean handleUserStream)
relativeUrl - The relative url of the feed, for example "statuses/firehose.json" for the firehose.count - Indicates the number of previous statuses to stream before transitioning to the live stream.public void retweet()
StatusStream,
Streaming API: Methods statuses/retweet
public StatusStream getRetweetStream()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Streaming API: Methods statuses/retweetpublic void sample()
StatusStream,
Streaming API: Methods statuses/sample
public StatusStream getSampleStream()
throws TwitterException
TwitterException - when Twitter service or network is unavailableStatusStream,
Streaming API: Methods statuses/samplepublic void user()
java.lang.IllegalStateException - when non-UserStreamListener is set, or no listener is setpublic void user(java.lang.String[] track)
track - keywords to track
java.lang.IllegalStateException - when non-UserStreamListener is set, or no listener is set
public UserStream getUserStream()
throws TwitterException
TwitterException - when Twitter service or network is unavailable
public UserStream getUserStream(java.lang.String[] track)
throws TwitterException
track - keywords to track
TwitterException - when Twitter service or network is unavailable
public void site(boolean withFollowings,
int[] follow)
withFollowings - whether to receive status updates from people followingfollow - an array of users to include in the streampublic void shutdown()
public void filter(FilterQuery query)
throws TwitterException
query - Filter query
TwitterExceptionStatusStream,
Streaming API: Methods statuses/filter
public StatusStream getFilterStream(FilterQuery query)
throws TwitterException
query - Filter query
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - filter
public void filter(int count,
int[] follow,
java.lang.String[] track)
filter(FilterQuery) instead
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.StatusStream,
Twitter API Wiki / Streaming API Documentation - filter
public StatusStream getFilterStream(int count,
int[] follow,
java.lang.String[] track)
throws TwitterException
getFilterStream(FilterQuery) instead
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 - filterpublic void cleanUp()
public void cleanup()
public void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
listener - listener to be addedpublic void setStatusListener(StatusListener listener)
addListener(StatusListener) instead.
listener - listener to be setpublic void addStatusListener(StatusListener statusListener)
addListener(StatusListener) instead.
statusListener - listener to be addedpublic void setUserStreamListener(UserStreamListener listener)
addListener(UserStreamListener) instead.
listener - listener to be setpublic void addUserStreamListener(UserStreamListener userStreamListener)
addListener(UserStreamListener) instead.
userStreamListener - listener to be addedpublic void addListener(UserStreamListener listener)
listener - public void addListener(StatusListener listener)
listener - public void addListener(SiteStreamsListener listener)
listener -
public RequestToken getOAuthRequestToken()
throws TwitterException
getOAuthRequestToken in interface OAuthSupportTwitterException - when Twitter service or network is unavailable
public RequestToken getOAuthRequestToken(java.lang.String callbackUrl)
throws TwitterException
getOAuthRequestToken in interface OAuthSupportcallbackUrl - callback URL
TwitterException - when Twitter service or network is unavailable
public AccessToken getOAuthAccessToken()
throws TwitterException
getOAuthAccessToken in interface OAuthSupportTwitterException - When Twitter service or network is unavailable, when the user has not authorized, or when the client application is not permitted to use xAuth
public AccessToken getOAuthAccessToken(java.lang.String oauthVerifier)
throws TwitterException
getOAuthAccessToken in interface OAuthSupportoauthVerifier - OAuth verifier. AKA pin.
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
public AccessToken getOAuthAccessToken(RequestToken requestToken)
throws TwitterException
getOAuthAccessToken in interface OAuthSupportrequestToken - the request token
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
public AccessToken getOAuthAccessToken(RequestToken requestToken,
java.lang.String oauthVerifier)
throws TwitterException
getOAuthAccessToken in interface OAuthSupportrequestToken - the request tokenoauthVerifier - OAuth verifier. AKA pin.
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
TwitterException - when Twitter service or network is unavailable, or the user has not authorizedpublic void setOAuthAccessToken(AccessToken accessToken)
setOAuthAccessToken in interface OAuthSupportaccessToken - accessToken
public AccessToken getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
throws TwitterException
getOAuthAccessToken in interface OAuthSupporttoken - the screen nametokenSecret - the password
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
public AccessToken getOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret,
java.lang.String pin)
throws TwitterException
token - request tokentokenSecret - request token secretpin - pin
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
public void setOAuthAccessToken(java.lang.String token,
java.lang.String tokenSecret)
TwitterFactory.getInstance(twitter4j.http.Authorization) instead
token - access tokentokenSecret - access token secret
java.lang.IllegalStateException - when AccessToken has already been retrieved or setpublic boolean isOAuthEnabled()
public void setOAuthConsumer(java.lang.String consumerKey,
java.lang.String consumerSecret)
consumerKey - OAuth consumer keyconsumerSecret - OAuth consumer secretpublic void setRateLimitStatusListener(RateLimitStatusListener listener)
listener - the listener to be addedpublic boolean equals(java.lang.Object o)
public int hashCode()
public void httpResponseReceived(twitter4j.internal.http.HttpResponseEvent event)
httpResponseReceived in interface twitter4j.internal.http.HttpResponseListenerpublic final boolean isBasicAuthEnabled()
public final Authorization getAuthorization()
public Configuration getConfiguration()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||