|
|||||||||
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, 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 TwitterStream
count
- 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 TwitterStream
count
- 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 TwitterStream
count
- 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 TwitterStream
count
- 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
TwitterException
public void retweet()
retweet
in interface TwitterStream
StatusStream
,
Streaming API: Methods statuses/retweetpublic StatusStream getRetweetStream() throws TwitterException
getRetweetStream
in interface TwitterStream
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Streaming API: Methods statuses/retweetpublic void sample()
sample
in interface TwitterStream
StatusStream
,
Streaming API: Methods statuses/samplepublic StatusStream getSampleStream() throws TwitterException
getSampleStream
in interface TwitterStream
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Streaming API: Methods statuses/samplepublic void user()
user
in interface TwitterStream
public void user(java.lang.String[] track)
user
in interface TwitterStream
track
- keywords to trackpublic UserStream getUserStream() throws TwitterException
getUserStream
in interface TwitterStream
TwitterException
- when Twitter service or network is unavailablepublic UserStream getUserStream(java.lang.String[] track) throws TwitterException
getUserStream
in interface TwitterStream
track
- keywords to track
TwitterException
- when Twitter service or network is unavailablepublic void site(boolean withFollowings, long[] follow)
site
in interface TwitterStream
withFollowings
- 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
TwitterException
public void filter(FilterQuery query)
filter
in interface TwitterStream
query
- Filter queryStatusStream
,
Streaming API: Methods statuses/filterpublic StatusStream getFilterStream(FilterQuery query) throws TwitterException
getFilterStream
in interface TwitterStream
query
- 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 TwitterStream
public void shutdown()
shutdown
in interface TwitterBase
shutdown
in interface TwitterStream
shutdown
in class TwitterBaseImpl
public void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener)
addConnectionLifeCycleListener
in interface TwitterStream
listener
- listener to be addedpublic void addListener(UserStreamListener listener)
addListener
in interface TwitterStream
listener
- listener to addpublic void addListener(StatusListener listener)
addListener
in interface TwitterStream
listener
- listener to addpublic void addListener(SiteStreamsListener listener)
addListener
in interface TwitterStream
listener
- listener to addprivate void addListener(StreamListener listener)
public boolean equals(java.lang.Object o)
equals
in class TwitterBaseImpl
public int hashCode()
hashCode
in class TwitterBaseImpl
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |