|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttwitter4j.TwitterBase
twitter4j.TwitterStream
public final class TwitterStream
A java representation of the Twitter Streaming API
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 |
TwitterStream.StreamHandlingThread
|
Field Summary | |
---|---|
private TwitterStream.StreamHandlingThread |
handler
|
private twitter4j.internal.http.HttpClientWrapper |
http
|
private static int |
HTTP_ERROR_INITIAL_WAIT
|
private static int |
HTTP_ERROR_WAIT_CAP
|
private static twitter4j.internal.logging.Logger |
logger
|
private static long |
serialVersionUID
|
private StatusListener |
statusListener
|
private static int |
TCP_ERROR_INITIAL_WAIT
|
private static int |
TCP_ERROR_WAIT_CAP
|
Fields inherited from class twitter4j.TwitterBase |
---|
auth, conf |
Constructor Summary | |
---|---|
TwitterStream()
Deprecated. use TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(Configuration conf,
Authorization auth,
StatusListener listener)
|
|
TwitterStream(java.lang.String screenName,
java.lang.String password)
Deprecated. use TwitterStreamFactory.getInstance() instead. |
|
TwitterStream(java.lang.String screenName,
java.lang.String password,
StatusListener listener)
Deprecated. use TwitterStreamFactory.getInstance() instead. |
Method Summary | |
---|---|
void |
cleanup()
|
void |
filter(FilterQuery query)
Start consuming public statuses that match one or more filter predicates. |
void |
filter(int count,
int[] follow,
java.lang.String[] track)
Deprecated. use filter(FilterQuery) instead |
void |
firehose(int count)
Starts listening on all public statuses. |
StatusStream |
getFilterStream(FilterQuery query)
Returns public statuses that match one or more filter predicates. |
StatusStream |
getFilterStream(int count,
int[] follow,
java.lang.String[] track)
Deprecated. use getFilterStream(FilterQuery) instead |
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. |
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 |
setStatusListener(StatusListener statusListener)
|
private void |
startHandler(TwitterStream.StreamHandlingThread handler)
|
Methods inherited from class twitter4j.TwitterBase |
---|
ensureAuthorizationEnabled, ensureBasicEnabled, equals, getAuthorization, hashCode, isBasicAuthEnabled, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final twitter4j.internal.http.HttpClientWrapper http
private static final twitter4j.internal.logging.Logger logger
private StatusListener statusListener
private TwitterStream.StreamHandlingThread handler
private static final long serialVersionUID
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
Constructor Detail |
---|
public TwitterStream()
TwitterStreamFactory.getInstance()
instead.
public TwitterStream(java.lang.String screenName, java.lang.String password)
TwitterStreamFactory.getInstance()
instead.
screenName
- screen namepassword
- passwordpublic TwitterStream(java.lang.String screenName, java.lang.String password, StatusListener listener)
TwitterStreamFactory.getInstance()
instead.
screenName
- screen namepassword
- passwordlistener
- listenerTwitterStream(Configuration conf, Authorization auth, StatusListener listener)
Method Detail |
---|
public void firehose(int count)
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream
,
Twitter API Wiki / Streaming API Documentation - firehosepublic StatusStream getFirehoseStream(int count) throws TwitterException
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - firehosepublic void links(int count)
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.StatusStream
,
Twitter API Wiki / Streaming API Documentation - linkspublic StatusStream getLinksStream(int count) throws TwitterException
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - linkspublic void retweet()
StatusStream
,
Twitter API Wiki / Streaming API Documentation - retweetpublic StatusStream getRetweetStream() throws TwitterException
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - retweetpublic void sample()
StatusStream
,
Twitter API Wiki / Streaming API Documentation - samplepublic StatusStream getSampleStream() throws TwitterException
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - Samplingpublic void filter(FilterQuery query) throws TwitterException
query
- Filter query
TwitterException
StatusStream
,
Twitter API Wiki / Streaming API Documentation - filterpublic StatusStream getFilterStream(FilterQuery query) throws TwitterException
query
- Filter query
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - filterpublic void filter(int count, int[] follow, java.lang.String[] track)
filter(FilterQuery)
instead
count
- Indicates the number of previous statuses to stream before transitioning to the live stream.follow
- Specifies the users, by ID, to receive public tweets from.track
- Specifies keywords to track.StatusStream
,
Twitter API Wiki / Streaming API Documentation - filterpublic StatusStream getFilterStream(int count, int[] follow, java.lang.String[] track) throws TwitterException
getFilterStream(FilterQuery)
instead
follow
- Specifies the users, by ID, to receive public tweets from.
TwitterException
- when Twitter service or network is unavailableStatusStream
,
Twitter API Wiki / Streaming API Documentation - filterprivate void startHandler(TwitterStream.StreamHandlingThread handler)
public void cleanup()
public void setStatusListener(StatusListener statusListener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |