class TwitterStreamImpl extends TwitterBaseImpl implements TwitterStream
| Modifier and Type | Class and Description | 
|---|---|
(package private) class  | 
TwitterStreamImpl.TwitterStreamConsumer  | 
| Modifier and Type | Field and Description | 
|---|---|
(package private) static int | 
count  | 
private static twitter4j.internal.async.Dispatcher | 
dispatcher  | 
private TwitterStreamImpl.TwitterStreamConsumer | 
handler  | 
private twitter4j.internal.http.HttpClientWrapper | 
http  | 
private static int | 
HTTP_ERROR_INITIAL_WAIT  | 
private static int | 
HTTP_ERROR_WAIT_CAP  | 
private java.util.List<ConnectionLifeCycleListener> | 
lifeCycleListeners  | 
private static twitter4j.internal.logging.Logger | 
logger  | 
private static int | 
NO_WAIT  | 
private static int | 
numberOfHandlers  | 
private java.util.List<RawStreamListener> | 
rawStreamListeners  | 
private static long | 
serialVersionUID  | 
private java.util.List<StreamListener> | 
siteStreamsListeners  | 
private java.lang.String | 
stallWarningsGetParam  | 
private twitter4j.internal.http.HttpParameter | 
stallWarningsParam  | 
private java.util.List<StreamListener> | 
statusListeners  | 
private static int | 
TCP_ERROR_INITIAL_WAIT  | 
private static int | 
TCP_ERROR_WAIT_CAP  | 
private java.util.List<StreamListener> | 
userStreamListeners  | 
auth, conf, factory, id, screenName| Constructor and Description | 
|---|
TwitterStreamImpl(Configuration conf,
                 Authorization auth)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
Adds a ConnectionLifeCycleListener 
 | 
void | 
addListener(RawStreamListener listener) | 
void | 
addListener(SiteStreamsListener listener) | 
void | 
addListener(StatusListener listener) | 
void | 
addListener(UserStreamListener listener) | 
void | 
cleanUp()
shutdown internal stream consuming thread 
 | 
private void | 
ensureSiteStreamsListenerIsSet()  | 
private void | 
ensureStatusStreamListenerIsSet()
check if any listener is set. 
 | 
private void | 
ensureUserStreamListenerIsSet()  | 
boolean | 
equals(java.lang.Object o)  | 
void | 
filter(FilterQuery query)
Start consuming public statuses that match one or more filter predicates. 
 | 
void | 
firehose(int count)
Starts listening on all public statuses. 
 | 
private StatusStream | 
getCountStream(java.lang.String relativeUrl,
              int count)  | 
private twitter4j.internal.async.Dispatcher | 
getDispatcher()  | 
StatusStream | 
getFilterStream(FilterQuery query)
Returns public statuses that match one or more filter predicates. 
 | 
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. 
 | 
StatusStream | 
getRetweetStream()
Returns a stream of all retweets. 
 | 
StatusStream | 
getSampleStream()
Returns a stream of random sample of all public statuses. 
 | 
(package private) java.io.InputStream | 
getSiteStream(boolean withFollowings,
             long[] follow)  | 
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 | 
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 | 
shutdown()
Shuts down this instance and releases allocated resources. 
 | 
StreamController | 
site(boolean withFollowings,
    long[] follow)
Site Streams, a new feature on the Streaming API, is now available for beta testing. 
 | 
private void | 
startHandler(TwitterStreamImpl.TwitterStreamConsumer handler)  | 
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. 
 | 
addRateLimitStatusListener, ensureAuthorizationEnabled, ensureOAuthEnabled, fillInIDAndScreenName, getAuthorization, getConfiguration, getId, getOAuth2Token, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, getScreenName, httpResponseReceived, invalidateOAuth2Token, setFactory, setOAuth2Token, setOAuthAccessToken, setOAuthConsumerclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, setOAuthAccessToken, setOAuthConsumeraddRateLimitStatusListener, getAuthorization, getConfiguration, getId, getScreenNameprivate static final long serialVersionUID
private final twitter4j.internal.http.HttpClientWrapper http
private static final twitter4j.internal.logging.Logger logger
private java.util.List<ConnectionLifeCycleListener> lifeCycleListeners
private TwitterStreamImpl.TwitterStreamConsumer handler
private java.lang.String stallWarningsGetParam
private twitter4j.internal.http.HttpParameter stallWarningsParam
private static transient twitter4j.internal.async.Dispatcher dispatcher
private static int numberOfHandlers
private java.util.List<StreamListener> userStreamListeners
private java.util.List<StreamListener> statusListeners
private java.util.List<StreamListener> siteStreamsListeners
private java.util.List<RawStreamListener> rawStreamListeners
private static final int TCP_ERROR_INITIAL_WAIT
private static final int TCP_ERROR_WAIT_CAP
private static final int HTTP_ERROR_INITIAL_WAIT
private static final int HTTP_ERROR_WAIT_CAP
private static final int NO_WAIT
static int count
TwitterStreamImpl(Configuration conf, Authorization auth)
public void firehose(int count)
firehose in interface TwitterStreamcount - Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream, 
Streaming API Methods statuses/firehosepublic StatusStream getFirehoseStream(int count) throws TwitterException
getFirehoseStream in interface TwitterStreamcount - 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)
links in interface TwitterStreamcount - Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream, 
Streaming API Methods statuses/linkspublic StatusStream getLinksStream(int count) throws TwitterException
getLinksStream in interface TwitterStreamcount - 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/linksprivate StatusStream getCountStream(java.lang.String relativeUrl, int count) throws TwitterException
TwitterExceptionpublic void retweet()
retweet in interface TwitterStreamStatusStream, 
Streaming API Methods statuses/retweetpublic StatusStream getRetweetStream() throws TwitterException
getRetweetStream in interface TwitterStreamTwitterException - when Twitter service or network is unavailableStatusStream, 
Streaming API: Methods statuses/retweetpublic void sample()
sample in interface TwitterStreamStatusStream, 
Streaming API: Methods statuses/samplepublic StatusStream getSampleStream() throws TwitterException
getSampleStream in interface TwitterStreamTwitterException - when Twitter service or network is unavailableStatusStream, 
Streaming API: Methods statuses/samplepublic void user()
user in interface TwitterStreampublic void user(java.lang.String[] track)
user in interface TwitterStreamtrack - keywords to trackpublic UserStream getUserStream() throws TwitterException
getUserStream in interface TwitterStreamTwitterException - when Twitter service or network is unavailablepublic UserStream getUserStream(java.lang.String[] track) throws TwitterException
getUserStream in interface TwitterStreamtrack - keywords to trackTwitterException - when Twitter service or network is unavailablepublic StreamController site(boolean withFollowings, long[] follow)
site in interface TwitterStreamwithFollowings - whether to receive status updates from people followingfollow - an array of users to include in the streamprivate twitter4j.internal.async.Dispatcher getDispatcher()
java.io.InputStream getSiteStream(boolean withFollowings,
                                long[] follow)
                            throws TwitterException
TwitterExceptionpublic void filter(FilterQuery query)
filter in interface TwitterStreamquery - Filter queryStatusStream, 
Streaming API Methods statuses/filterpublic StatusStream getFilterStream(FilterQuery query) throws TwitterException
getFilterStream in interface TwitterStreamquery - Filter queryTwitterException - when Twitter service or network is unavailableStatusStream, 
Streaming API Methods | Twitter Developersprivate void ensureStatusStreamListenerIsSet()
java.lang.IllegalStateException - when no listener is set.private void ensureUserStreamListenerIsSet()
private void ensureSiteStreamsListenerIsSet()
private void startHandler(TwitterStreamImpl.TwitterStreamConsumer handler)
public void cleanUp()
cleanUp in interface TwitterStreampublic void shutdown()
shutdown in interface TwitterBaseshutdown in interface TwitterStreamshutdown in class TwitterBaseImplpublic void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
addConnectionLifeCycleListener in interface TwitterStreamlistener - listener to be addedpublic void addListener(UserStreamListener listener)
addListener in interface TwitterStreamlistener - listener to addpublic void addListener(StatusListener listener)
addListener in interface TwitterStreamlistener - listener to addpublic void addListener(SiteStreamsListener listener)
addListener in interface TwitterStreamlistener - listener to addpublic void addListener(RawStreamListener listener)
addListener in interface TwitterStreamlistener - listener to addpublic boolean equals(java.lang.Object o)
equals in class TwitterBaseImplpublic int hashCode()
hashCode in class TwitterBaseImplpublic java.lang.String toString()
toString in class TwitterBaseImpl