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 static long |
serialVersionUID |
private java.lang.String |
stallWarningsGetParam |
private twitter4j.internal.http.HttpParameter |
stallWarningsParam |
private StreamListener[] |
streamListeners |
private static int |
TCP_ERROR_INITIAL_WAIT |
private static int |
TCP_ERROR_WAIT_CAP |
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(SiteStreamsListener listener) |
void |
addListener(StatusListener listener) |
private void |
addListener(StreamListener listener) |
void |
addListener(UserStreamListener listener) |
void |
cleanUp()
shutdown internal stream consuming thread
|
private void |
ensureListenerIsSet()
check if any listener is set.
|
private void |
ensureStatusStreamListenerIsSet() |
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, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, getScreenName, httpResponseReceived, setFactory, 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 StreamListener[] streamListeners
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 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 ensureListenerIsSet()
java.lang.IllegalStateException - when no listener is set.private void ensureStatusStreamListenerIsSet()
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 addprivate void addListener(StreamListener listener)
public boolean equals(java.lang.Object o)
equals in class TwitterBaseImplpublic int hashCode()
hashCode in class TwitterBaseImplpublic java.lang.String toString()
toString in class TwitterBaseImpl