twitter4j
Class TwitterStream

java.lang.Object
  extended by twitter4j.TwitterStream
All Implemented Interfaces:
java.io.Serializable, OAuthSupport, twitter4j.internal.http.HttpResponseCode, twitter4j.internal.http.HttpResponseListener

public final class TwitterStream
extends java.lang.Object

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.

Since:
Twitter4J 2.0.4
Author:
Yusuke Yamamoto - yusuke at mac.com
See Also:
Serialized Form

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

TwitterStream

public TwitterStream()
Deprecated. use TwitterStreamFactory.getInstance() instead.

Constructs a TwitterStream instance. UserID and password should be provided by either twitter4j.properties or system property. since Twitter4J 2.0.10


TwitterStream

public TwitterStream(java.lang.String screenName,
                     java.lang.String password)
Deprecated. use TwitterStreamFactory.getInstance() instead.

Constructs a TwitterStream instance. UserID and password should be provided by either twitter4j.properties or system property. since Twitter4J 2.0.10

Parameters:
screenName - screen name
password - password

TwitterStream

public TwitterStream(java.lang.String screenName,
                     java.lang.String password,
                     twitter4j.StreamListener listener)
Deprecated. use TwitterStreamFactory.getInstance() instead.

Constructs a TwitterStream instance. UserID and password should be provided by either twitter4j.properties or system property. since Twitter4J 2.0.10

Parameters:
screenName - screen name
password - password
listener - listener
Method Detail

firehose

public void firehose(int count)
Starts listening on all public statuses. Available only to approved parties and requires a signed agreement to access. Please do not contact us about access to the firehose. If your service warrants access to it, we'll contact you.

Parameters:
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
Since:
Twitter4J 2.0.4
See Also:
StatusStream, Streaming API: Methods statuses/firehose

getFirehoseStream

public StatusStream getFirehoseStream(int count)
                               throws TwitterException
Returns a status stream of all public statuses. Available only to approved parties and requires a signed agreement to access. Please do not contact us about access to the firehose. If your service warrants access to it, we'll contact you.

Parameters:
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.4
See Also:
StatusStream, Streaming API: Methods statuses/firehose

links

public void links(int count)
Starts listening on all public statuses containing links. Available only to approved parties and requires a signed agreement to access. Please do not contact us about access to the links stream. If your service warrants access to it, we'll contact you.

Parameters:
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
Since:
Twitter4J 2.1.1
See Also:
StatusStream, Streaming API: Methods statuses/links

getLinksStream

public StatusStream getLinksStream(int count)
                            throws TwitterException
Returns a status stream of all public statuses containing links. Available only to approved parties and requires a signed agreement to access. Please do not contact us about access to the links stream. If your service warrants access to it, we'll contact you.

Parameters:
count - Indicates the number of previous statuses to stream before transitioning to the live stream.
Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.1
See Also:
StatusStream, Streaming API: Methods statuses/links

stream

public void stream(java.lang.String relativeUrl,
                   int count,
                   boolean handleUserStream)
Deprecated. 

Starts listening on a tweet stream.

Parameters:
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.

retweet

public void retweet()
Starts listening on all retweets. The retweet stream is not a generally available resource. Few applications require this level of access. Creative use of a combination of other resources and various access levels can satisfy nearly every application use case. As of 9/11/2009, the site-wide retweet feature has not yet launched, so there are currently few, if any, retweets on this stream.

Since:
Twitter4J 2.0.10
See Also:
StatusStream, Streaming API: Methods statuses/retweet

getRetweetStream

public StatusStream getRetweetStream()
                              throws TwitterException
Returns a stream of all retweets. The retweet stream is not a generally available resource. Few applications require this level of access. Creative use of a combination of other resources and various access levels can satisfy nearly every application use case. As of 9/11/2009, the site-wide retweet feature has not yet launched, so there are currently few, if any, retweets on this stream.

Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.10
See Also:
StatusStream, Streaming API: Methods statuses/retweet

sample

public void sample()
Starts listening on random sample of all public statuses. The default access level provides a small proportion of the Firehose. The "Gardenhose" access level provides a proportion more suitable for data mining and research applications that desire a larger proportion to be statistically significant sample.

Since:
Twitter4J 2.0.10
See Also:
StatusStream, Streaming API: Methods statuses/sample

getSampleStream

public StatusStream getSampleStream()
                             throws TwitterException
Returns a stream of random sample of all public statuses. The default access level provides a small proportion of the Firehose. The "Gardenhose" access level provides a proportion more suitable for data mining and research applications that desire a larger proportion to be statistically significant sample.

Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.10
See Also:
StatusStream, Streaming API: Methods statuses/sample

user

public void user()
User Streams provides real-time updates of all data needed to update a desktop application display. Applications can request startup back-fill from the REST API and then transition to Streaming for nearly all subsequent reads. Rate limits and latency are practically eliminated. Desktop developers can stop managing rate limits and use this new data to create an entirely new user experience. On our end, we hope to reduce costs and increase site reliability.

Throws:
java.lang.IllegalStateException - when non-UserStreamListener is set, or no listener is set
See Also:
User Streams

user

public void user(java.lang.String[] track)
User Streams provides real-time updates of all data needed to update a desktop application display. Applications can request startup back-fill from the REST API and then transition to Streaming for nearly all subsequent reads. Rate limits and latency are practically eliminated. Desktop developers can stop managing rate limits and use this new data to create an entirely new user experience. On our end, we hope to reduce costs and increase site reliability.

Parameters:
track - keywords to track
Throws:
java.lang.IllegalStateException - when non-UserStreamListener is set, or no listener is set
Since:
Twitter4J 2.1.9
See Also:
User Streams

getUserStream

public UserStream getUserStream()
                         throws TwitterException
User Streams provides real-time updates of all data needed to update a desktop application display. Applications can request startup back-fill from the REST API and then transition to Streaming for nearly all subsequent reads. Rate limits and latency are practically eliminated. Desktop developers can stop managing rate limits and use this new data to create an entirely new user experience. On our end, we hope to reduce costs and increase site reliability.

Returns:
UserStream
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
User Streams

getUserStream

public UserStream getUserStream(java.lang.String[] track)
                         throws TwitterException
User Streams provides real-time updates of all data needed to update a desktop application display. Applications can request startup back-fill from the REST API and then transition to Streaming for nearly all subsequent reads. Rate limits and latency are practically eliminated. Desktop developers can stop managing rate limits and use this new data to create an entirely new user experience. On our end, we hope to reduce costs and increase site reliability.

Parameters:
track - keywords to track
Returns:
UserStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.9
See Also:
User Streams

site

public void site(boolean withFollowings,
                 int[] follow)
Site Streams, a new feature on the Streaming API, is now available for beta testing. Site Streams allows services, such as web sites or mobile push services, to receive real-time updates for a large number of users without any of the hassles of managing REST API rate limits. The initial version delivers events created by, or directed to, users that have shared their OAuth token with your application. The following events are streamed immediately, and without rate limits: Home Timelines, Mentions Timelines, User Timelines, Direct Messages, Mentions, Follows, Favorites, Tweets, Retweets, Profile changes, and List changes. The following limitations must be respected during the beta period. These limitations may be changed with little advance notice. We intend to increase or remove these various limitations as we move from beta test into full production:
Limit the follow count to 100 users per stream. Clients must occasionally compact users onto a smaller number of connections to minimize the total number of connections outstanding.
Open no more than 25 new connections per second and exponentially back-off on errors.

Parameters:
withFollowings - whether to receive status updates from people following
follow - an array of users to include in the stream
Since:
Twitter4J 2.1.8
See Also:
Site Streams | dev.twitter.com

shutdown

public void shutdown()
Shuts down internal dispatcher thread used by site stream.

Since:
Twitter4J 2.1.9

filter

public void filter(FilterQuery query)
            throws TwitterException
Start consuming public statuses that match one or more filter predicates. At least one predicate parameter, follow, locations, or track must be specified. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Placing long parameters in the URL may cause the request to be rejected for excessive URL length.
The default access level allows up to 200 track keywords, 400 follow userids and 10 1-degree location boxes. Increased access levels allow 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" role), 10,000 track keywords ("restricted track" role), 200,000 track keywords ("partner track" role), and 200 10-degree location boxes ("locRestricted" role). Increased track access levels also pass a higher proportion of statuses before limiting the stream.

Parameters:
query - Filter query
Throws:
TwitterException
Since:
Twitter4J 2.1.2
See Also:
StatusStream, Streaming API: Methods statuses/filter

getFilterStream

public StatusStream getFilterStream(FilterQuery query)
                             throws TwitterException
Returns public statuses that match one or more filter predicates. At least one predicate parameter, follow, locations, or track must be specified. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Placing long parameters in the URL may cause the request to be rejected for excessive URL length.
The default access level allows up to 200 track keywords, 400 follow userids and 10 1-degree location boxes. Increased access levels allow 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" role), 10,000 track keywords ("restricted track" role), 200,000 track keywords ("partner track" role), and 200 10-degree location boxes ("locRestricted" role). Increased track access levels also pass a higher proportion of statuses before limiting the stream.

Parameters:
query - Filter query
Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.1.2
See Also:
StatusStream, Twitter API Wiki / Streaming API Documentation - filter

filter

public void filter(int count,
                   int[] follow,
                   java.lang.String[] track)
Deprecated. use filter(FilterQuery) instead

Start consuming public statuses that match one or more filter predicates. At least one predicate parameter, follow, locations, or track must be specified. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Placing long parameters in the URL may cause the request to be rejected for excessive URL length.
The default access level allows up to 200 track keywords, 400 follow userids and 10 1-degree location boxes. Increased access levels allow 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" role), 10,000 track keywords ("restricted track" role), 200,000 track keywords ("partner track" role), and 200 10-degree location boxes ("locRestricted" role). Increased track access levels also pass a higher proportion of statuses before limiting the stream.

Parameters:
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.
Since:
Twitter4J 2.0.10
See Also:
StatusStream, Twitter API Wiki / Streaming API Documentation - filter

getFilterStream

public StatusStream getFilterStream(int count,
                                    int[] follow,
                                    java.lang.String[] track)
                             throws TwitterException
Deprecated. use getFilterStream(FilterQuery) instead

Returns public statuses that match one or more filter predicates. At least one predicate parameter, follow, locations, or track must be specified. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Placing long parameters in the URL may cause the request to be rejected for excessive URL length.
The default access level allows up to 200 track keywords, 400 follow userids and 10 1-degree location boxes. Increased access levels allow 80,000 follow userids ("shadow" role), 400,000 follow userids ("birddog" role), 10,000 track keywords ("restricted track" role), 200,000 track keywords ("partner track" role), and 200 10-degree location boxes ("locRestricted" role). Increased track access levels also pass a higher proportion of statuses before limiting the stream.

Parameters:
follow - Specifies the users, by ID, to receive public tweets from.
Returns:
StatusStream
Throws:
TwitterException - when Twitter service or network is unavailable
Since:
Twitter4J 2.0.10
See Also:
StatusStream, Twitter API Wiki / Streaming API Documentation - filter

cleanUp

public void cleanUp()
shutdown internal stream consuming thread

Since:
Twitter4J 2.1.7

cleanup

public void cleanup()
Deprecated. use #cleanUp instead


addConnectionLifeCycleListener

public void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
Adds a ConnectionLifeCycleListener

Parameters:
listener - listener to be added
Since:
Twitter4J 2.1.7

setStatusListener

public void setStatusListener(StatusListener listener)
Deprecated. use addListener(StatusListener) instead.

Clear existing listeners and sets a StatusListener

Parameters:
listener - listener to be set

addStatusListener

public void addStatusListener(StatusListener statusListener)
Deprecated. use addListener(StatusListener) instead.

Parameters:
statusListener - listener to be added
Since:
Twitter4J 2.1.7

setUserStreamListener

public void setUserStreamListener(UserStreamListener listener)
Deprecated. use addListener(UserStreamListener) instead.

Clear existing listeners and sets a UserStreamListener

Parameters:
listener - listener to be set

addUserStreamListener

public void addUserStreamListener(UserStreamListener userStreamListener)
Deprecated. use addListener(UserStreamListener) instead.

Parameters:
userStreamListener - listener to be added
Since:
Twitter4J 2.1.7

addListener

public void addListener(UserStreamListener listener)
Parameters:
listener -
Since:
Twitter4J 2.1.8

addListener

public void addListener(StatusListener listener)
Parameters:
listener -
Since:
Twitter4J 2.1.8

addListener

public void addListener(SiteStreamsListener listener)
Parameters:
listener -
Since:
Twitter4J 2.1.8

getOAuthRequestToken

public RequestToken getOAuthRequestToken()
                                  throws TwitterException
Retrieves a request token

Specified by:
getOAuthRequestToken in interface OAuthSupport
Returns:
generated request token.
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
OAuth FAQ | dev.twitter.com, OAuth Core 1.0a - 6.1. Obtaining an Unauthorized Request Token

getOAuthRequestToken

public RequestToken getOAuthRequestToken(java.lang.String callbackUrl)
                                  throws TwitterException
Retrieves a request token

Specified by:
getOAuthRequestToken in interface OAuthSupport
Parameters:
callbackUrl - callback URL
Returns:
generated request token
Throws:
TwitterException - when Twitter service or network is unavailable
See Also:
OAuth FAQ | dev.twitter.com, OAuth Core 1.0a - 6.1. Obtaining an Unauthorized Request Token

getOAuthAccessToken

public AccessToken getOAuthAccessToken()
                                throws TwitterException
Returns an access token associated with this instance.
If no access token is associated with this instance, this will retrieve a new access token. Basic authenticated instance of this class will try acquiring an AccessToken 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. Web-based applications will not be granted access, except on a temporary basis for when they are converting from basic-authentication support to full OAuth support.
Storage of Twitter usernames and passwords is forbidden. By using xAuth, you are required to store only access tokens and access token secrets. If the access token expires or is expunged by a user, you must ask for their login and password again before exchanging the credentials for an access token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Returns:
access token
Throws:
TwitterException - When Twitter service or network is unavailable, when the user has not authorized, or when the client application is not permitted to use xAuth
See Also:
Twitter REST API Method: oauth access_token for xAuth

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String oauthVerifier)
                                throws TwitterException
Retrieves an access token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
oauthVerifier - OAuth verifier. AKA pin.
Returns:
access token
Throws:
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
See Also:
OAuth FAQ | dev.twitter.com - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

getOAuthAccessToken

public AccessToken getOAuthAccessToken(RequestToken requestToken)
                                throws TwitterException
Retrieves an access token associated with the supplied request token and sets userId.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
requestToken - the request token
Returns:
access token associated with the supplied request token.
Throws:
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
See Also:
OAuth FAQ | dev.twitter.com - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

getOAuthAccessToken

public AccessToken getOAuthAccessToken(RequestToken requestToken,
                                       java.lang.String oauthVerifier)
                                throws TwitterException
Retrieves an access token associated with the supplied request token and sets userId.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
requestToken - the request token
oauthVerifier - OAuth verifier. AKA pin.
Returns:
access token associated with the supplied request token.
Throws:
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
See Also:
OAuth Core 1.0a - 6.2. Obtaining User Authorization

setOAuthAccessToken

public void setOAuthAccessToken(AccessToken accessToken)
Sets the access token

Specified by:
setOAuthAccessToken in interface OAuthSupport
Parameters:
accessToken - accessToken

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String token,
                                       java.lang.String tokenSecret)
                                throws TwitterException
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. Web-based applications will not be granted access, except on a temporary basis for when they are converting from basic-authentication support to full OAuth support.
Storage of Twitter usernames and passwords is forbidden. By using xAuth, you are required to store only access tokens and access token secrets. If the access token expires or is expunged by a user, you must ask for their login and password again before exchanging the credentials for an access token.

Specified by:
getOAuthAccessToken in interface OAuthSupport
Parameters:
token - the screen name
tokenSecret - the password
Returns:
access token associated with the supplied request token.
Throws:
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
OAuth FAQ | dev.twitter.com - How long does an access token last?, Twitter REST API Method: oauth access_token for xAuth

getOAuthAccessToken

public AccessToken getOAuthAccessToken(java.lang.String token,
                                       java.lang.String tokenSecret,
                                       java.lang.String pin)
                                throws TwitterException
Retrieves an access token associated with the supplied request token.

Parameters:
token - request token
tokenSecret - request token secret
pin - pin
Returns:
access token associated with the supplied request token.
Throws:
TwitterException - when Twitter service or network is unavailable, or the user has not authorized
See Also:
Twitter API Wiki - How long does an access token last?, OAuth Core 1.0a - 6.2. Obtaining User Authorization

setOAuthAccessToken

public void setOAuthAccessToken(java.lang.String token,
                                java.lang.String tokenSecret)
Deprecated. Use TwitterFactory.getInstance(twitter4j.http.Authorization) instead

Sets the access token

Parameters:
token - access token
tokenSecret - access token secret
Throws:
java.lang.IllegalStateException - when AccessToken has already been retrieved or set
Since:
Twitter 2.0.0

isOAuthEnabled

public boolean isOAuthEnabled()
tests if the instance is authenticated by Basic

Returns:
returns true if the instance is authenticated by Basic

setOAuthConsumer

public void setOAuthConsumer(java.lang.String consumerKey,
                             java.lang.String consumerSecret)
sets the OAuth consumer key and consumer secret

Parameters:
consumerKey - OAuth consumer key
consumerSecret - OAuth consumer secret

setRateLimitStatusListener

public void setRateLimitStatusListener(RateLimitStatusListener listener)
Registers a RateLimitStatusListener for account associated rate limits

Parameters:
listener - the listener to be added
Since:
Twitter4J 2.1.0
See Also:
Twitter API Wiki / Twitter REST API Method: account rate_limit_status

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

httpResponseReceived

public void httpResponseReceived(twitter4j.internal.http.HttpResponseEvent event)
Specified by:
httpResponseReceived in interface twitter4j.internal.http.HttpResponseListener

isBasicAuthEnabled

public final boolean isBasicAuthEnabled()
tests if the instance is authenticated by Basic

Returns:
returns true if the instance is authenticated by Basic

getAuthorization

public final Authorization getAuthorization()
Returns the authorization scheme for this instance.
The returned type will be either of BasicAuthorization, OAuthAuthorization, or NullAuthorization

Returns:
the authorization scheme for this instance

getConfiguration

public Configuration getConfiguration()
Returns the configuration associated with this instance

Returns:
configuration associated with this instance
Since:
Twitter4J 2.1.8

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.