twitter4j

## Class TwitterStreamFactory

- java.lang.Object
- - 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

Constructors
Constructor and Description
`TwitterStreamFactory()` Creates a TwitterStreamFactory with the root configuration.
`TwitterStreamFactory(Configuration conf)` Creates a TwitterStreamFactory with the given configuration.
`TwitterStreamFactory(java.lang.String configTreePath)` Creates a TwitterStreamFactory with a specified config tree.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`TwitterStream` `getInstance()` Returns a instance associated with the configuration bound to this factory.
`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)` Returns a instance.
`static TwitterStream` `getSingleton()` Returns default singleton TwitterStream instance.

### 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(java.lang.String configTreePath)

Creates a TwitterStreamFactory with a specified config tree.

Parameters:
  `configTreePath` - the path

### Method Detail

#### getInstance

    public TwitterStream getInstance()

Returns a instance associated with the configuration bound to this factory.

Returns:
  default 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 `OAuthSupport.setOAuthAccessToken(twitter4j.auth.AccessToken)`, this factory method potentially returns a cached instance.

Parameters:
  `accessToken` - access token
Returns:
  an instance

#### getInstance

    public TwitterStream getInstance(Authorization auth)

Returns a instance.

Parameters:
  `auth` - authorization object to be associated
Returns:
  an instance

#### getSingleton

    public static TwitterStream getSingleton()

Returns default singleton TwitterStream instance.

Returns:
  default singleton TwitterStream instance
Since:
  Twitter4J 2.2.4