public interface TwitterStream extends OAuthSupport, TwitterBase
Modifier and Type | Method and Description |
---|---|
void |
addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
Adds a ConnectionLifeCycleListener
|
void |
addListener(StreamListener listener) |
void |
cleanUp()
shutdown internal stream consuming thread
|
void |
clearListeners()
clear status listeners
|
void |
filter(FilterQuery query)
Start consuming public statuses that match one or more filter predicates.
|
void |
filter(java.lang.String... track)
Start consuming public statuses that match the filter predicate.
|
void |
firehose(int count)
Starts listening on all public statuses.
|
void |
links(int count)
Starts listening on all public statuses containing links.
|
TwitterStream |
onException(Consumer<java.lang.Exception> action) |
TwitterStream |
onStatus(Consumer<Status> action) |
void |
removeListener(StreamListener listener) |
void |
replaceListener(StreamListener toBeRemoved,
StreamListener toBeAdded)
replace existing listener
|
void |
retweet()
Starts listening on all retweets.
|
void |
sample()
Starts listening on random sample of all public statuses.
|
void |
sample(java.lang.String language)
Starts listening on random sample of all public statuses.
|
void |
shutdown()
Shuts down internal dispatcher thread shared by all TwitterStream instances.
|
StreamController |
site(boolean withFollowings,
long... follow)
Deprecated.
Since Twitter4J 4.0.7
|
void |
user()
Deprecated.
Since Twitter4J 4.0.7
|
void |
user(java.lang.String... track)
Deprecated.
Since Twitter4J 4.0.7
|
getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, setOAuthAccessToken, setOAuthConsumer
addRateLimitStatusListener, getAuthorization, getConfiguration, getId, getScreenName, onRateLimitReached, onRateLimitStatus
void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
listener
- listener to be addedvoid addListener(StreamListener listener)
listener
- listener to addTwitterStream onStatus(Consumer<Status> action)
action
- action when receiving StatusTwitterStream onException(Consumer<java.lang.Exception> action)
action
- action when receiving TwitterExceptionvoid removeListener(StreamListener listener)
listener
- listener to removevoid clearListeners()
void replaceListener(StreamListener toBeRemoved, StreamListener toBeAdded)
toBeRemoved
- listener to be removedtoBeAdded
- listener to be addedvoid firehose(int count)
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream
,
Streaming API Methods statuses/firehosevoid links(int count)
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream
,
Streaming API Methods statuses/linksvoid retweet()
StatusStream
,
Streaming API Methods statuses/retweetvoid sample()
StatusStream
,
Streaming API: Methods statuses/samplevoid sample(java.lang.String language)
Only samples Tweets written in the given language.
language
- language to be sampledStatusStream
,
Streaming API: Methods statuses/samplevoid user()
java.lang.IllegalStateException
- when non-UserStreamListener is set, or no listener is setvoid user(java.lang.String... track)
track
- keywords to trackjava.lang.IllegalStateException
- when non-UserStreamListener is set, or no listener is setStreamController site(boolean withFollowings, long... follow)
withFollowings
- whether to receive status updates from people followingfollow
- an array of users to include in the streamvoid filter(FilterQuery query)
query
- Filter queryStatusStream
,
Streaming API Methods statuses/filtervoid filter(java.lang.String... track)
track
- words to be filteredvoid cleanUp()
void shutdown()