|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttwitter4j.TwitterBaseImpl
twitter4j.TwitterStreamImpl
class TwitterStreamImpl
A java representation of the Streaming API: Methods
Note that this class is NOT compatible with Google App Engine as GAE is not capable of handling requests longer than 30 seconds.
| Nested Class Summary | |
|---|---|
(package private) class |
TwitterStreamImpl.TwitterStreamConsumer
|
| Field Summary | |
|---|---|
(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 StreamListener[] |
streamListeners
|
private static int |
TCP_ERROR_INITIAL_WAIT
|
private static int |
TCP_ERROR_WAIT_CAP
|
| Fields inherited from class twitter4j.TwitterBaseImpl |
|---|
auth, conf, id, screenName |
| Constructor Summary | |
|---|---|
TwitterStreamImpl(Configuration conf)
|
|
TwitterStreamImpl(Configuration conf,
Authorization auth)
|
|
| Method Summary | |
|---|---|
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()
|
void |
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)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface twitter4j.auth.OAuthSupport |
|---|
getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthAccessToken, getOAuthRequestToken, getOAuthRequestToken, getOAuthRequestToken, setOAuthAccessToken, setOAuthConsumer |
| Methods inherited from interface twitter4j.TwitterBase |
|---|
addRateLimitStatusListener, getAuthorization, getConfiguration, getId, getScreenName |
| Field Detail |
|---|
private 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 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
| Constructor Detail |
|---|
TwitterStreamImpl(Configuration conf,
Authorization auth)
TwitterStreamImpl(Configuration conf)
| Method Detail |
|---|
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/firehose
public 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/links
public 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/links
private StatusStream getCountStream(java.lang.String relativeUrl,
int count)
throws TwitterException
TwitterExceptionpublic void retweet()
retweet in interface TwitterStreamStatusStream,
Streaming API: Methods statuses/retweet
public 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/sample
public 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 track
public UserStream getUserStream()
throws TwitterException
getUserStream in interface TwitterStreamTwitterException - when Twitter service or network is unavailable
public UserStream getUserStream(java.lang.String[] track)
throws TwitterException
getUserStream in interface TwitterStreamtrack - keywords to track
TwitterException - when Twitter service or network is unavailable
public void 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/filter
public StatusStream getFilterStream(FilterQuery query)
throws TwitterException
getFilterStream in interface TwitterStreamquery - Filter query
TwitterException - when Twitter service or network is unavailableStatusStream,
Twitter API Wiki / Streaming API Documentation - filterprivate 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 TwitterBaseImpl
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||