twitter4j
Class TwitterStreamFactory

java.lang.Object
  extended by twitter4j.TwitterStreamFactory
All Implemented Interfaces:
java.io.Serializable

public final class TwitterStreamFactory
extends java.lang.Object
implements java.io.Serializable

A factory class for TwitterFactory.
An instance of this class is completely thread safe and can be re-used and used concurrently.
Note that TwitterStream is NOT compatible with Google App Engine as GAE is not capable of handling requests longer than 30 seconds.

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

Constructor Summary
TwitterStreamFactory()
          Creates a TwitterStreamFactory with the root configuration.
TwitterStreamFactory(Configuration conf)
          Creates a TwitterStreamFactory with the given configuration.
TwitterStreamFactory(Configuration conf, StatusListener listener)
          Deprecated. use TwitterStream.addListener(StatusListener) instead.
TwitterStreamFactory(Configuration conf, UserStreamListener listener)
          Deprecated. use TwitterStream.addListener(UserStreamListener) instead.
TwitterStreamFactory(StatusListener listener)
          Deprecated. use TwitterStream.addListener(StatusListener) instead.
TwitterStreamFactory(java.lang.String configTreePath)
          Creates a TwitterStreamFactory with a specified config tree.
TwitterStreamFactory(java.lang.String configTreePath, StatusListener listener)
          Deprecated. use TwitterStream.addListener(StatusListener) instead.
TwitterStreamFactory(java.lang.String configTreePath, UserStreamListener listener)
          Deprecated. use TwitterStream.addListener(UserStreamListener)} instead.
TwitterStreamFactory(UserStreamListener listener)
          Deprecated. use TwitterStream.addListener(UserStreamListener)} instead.
 
Method Summary
 TwitterStream getInstance()
          Returns an instance.
 TwitterStream getInstance(AccessToken accessToken)
          Returns a OAuth Authenticated instance.
consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.
 TwitterStream getInstance(Authorization auth)
          Deprecated.  
 TwitterStream getInstance(java.lang.String screenName, java.lang.String password)
          Returns an XAuth Authenticated instance.
 TwitterStream getOAuthAuthorizedInstance(AccessToken accessToken)
          Deprecated. use getInstance(twitter4j.http.AccessToken) instead
 TwitterStream getOAuthAuthorizedInstance(java.lang.String consumerKey, java.lang.String consumerSecret)
          Deprecated. use TwitterOAuthSupportBaseImpl.setOAuthConsumer(String, String)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwitterStreamFactory

public TwitterStreamFactory()
Creates a TwitterStreamFactory with the root configuration.


TwitterStreamFactory

public TwitterStreamFactory(Configuration conf)
Creates a TwitterStreamFactory with the given configuration.

Parameters:
conf - the configuration to use
Since:
Twitter4J 2.1.1

TwitterStreamFactory

public TwitterStreamFactory(StatusListener listener)
Deprecated. use TwitterStream.addListener(StatusListener) instead.

Creates a TwitterStreamFactory with the root configuration and a specified status listener.

Parameters:
listener - the listener

TwitterStreamFactory

public TwitterStreamFactory(UserStreamListener listener)
Deprecated. use TwitterStream.addListener(UserStreamListener)} instead.

Creates a TwitterStreamFactory with the root configuration and a specified status listener.

Parameters:
listener - the listener
Since:
Twitter4J 2.1.8

TwitterStreamFactory

public TwitterStreamFactory(java.lang.String configTreePath)
Creates a TwitterStreamFactory with a specified config tree.

Parameters:
configTreePath - the path

TwitterStreamFactory

public TwitterStreamFactory(java.lang.String configTreePath,
                            StatusListener listener)
Deprecated. use TwitterStream.addListener(StatusListener) instead.

Creates a TwitterStreamFactory with a specified config tree and a listener.

Parameters:
configTreePath - the path
listener - the listener

TwitterStreamFactory

public TwitterStreamFactory(java.lang.String configTreePath,
                            UserStreamListener listener)
Deprecated. use TwitterStream.addListener(UserStreamListener)} instead.

Creates a TwitterStreamFactory with a specified config tree and a listener.

Parameters:
configTreePath - the path
listener - the listener
Since:
Twitter4J 2.1.8

TwitterStreamFactory

public TwitterStreamFactory(Configuration conf,
                            StatusListener listener)
Deprecated. use TwitterStream.addListener(StatusListener) instead.

Creates a TwitterStreamFactory with the specified config and a listener.

Parameters:
conf - the configuration to use
listener - an optional status listener
Since:
Twitter4J 2.1.1

TwitterStreamFactory

public TwitterStreamFactory(Configuration conf,
                            UserStreamListener listener)
Deprecated. use TwitterStream.addListener(UserStreamListener) instead.

Creates a TwitterStreamFactory with the specified config and a listener.

Parameters:
conf - the configuration to use
listener - an optional status listener
Since:
Twitter4J 2.1.8
Method Detail

getInstance

public TwitterStream getInstance()
Returns an instance.

Returns:
default instance

getInstance

public TwitterStream getInstance(java.lang.String screenName,
                                 java.lang.String password)
Returns an XAuth Authenticated instance.

Parameters:
screenName - screen name
password - password
Returns:
an instance

getInstance

public TwitterStream getInstance(AccessToken accessToken)
Returns a OAuth Authenticated instance.
consumer key and consumer Secret must be provided by twitter4j.properties, or system properties. Unlike TwitterOAuthSupportBaseImpl.setOAuthAccessToken(twitter4j.http.AccessToken), this factory method potentially returns a cached instance.

Parameters:
accessToken - access token
Returns:
an instance

getOAuthAuthorizedInstance

public TwitterStream getOAuthAuthorizedInstance(java.lang.String consumerKey,
                                                java.lang.String consumerSecret)
Deprecated. use TwitterOAuthSupportBaseImpl.setOAuthConsumer(String, String)

Returns a OAuth Authenticated instance.

Parameters:
consumerKey - consumer key
consumerSecret - consumer secret
Returns:
an instance

getOAuthAuthorizedInstance

public TwitterStream getOAuthAuthorizedInstance(AccessToken accessToken)
Deprecated. use getInstance(twitter4j.http.AccessToken) instead

Returns a OAuth Authenticated instance.
consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.

Parameters:
accessToken - access token
Returns:
an instance

getInstance

public TwitterStream getInstance(Authorization auth)
Deprecated. 

Returns a instance.

Returns:
default singleton instance


Copyright © 2011. All Rights Reserved.