summaryrefslogtreecommitdiff
path: root/src/mining/Stream.java
blob: 36fba1b2325000e6149494b658100eda02b26d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package mining;

import java.io.IOException;

/**
 * Provides access to a stream. The implementor is supposed to provide means
 * that allows a client to be notified of new tweets.
 */
public interface Stream {

    /**
     * Add the keyword (or phrase) to the list of keywords to be watched in a
     * stream.
     *
     * @param keyword
     */
    public void watchKeyword(String keyword);

    /**
     * Removes the keyword (or phrase) from the list of keywords to watch for in
     * a stream.
     *
     * @param keyword
     */
    public void unwatchKeyword(String keyword);

    /**
     * Starts streaming tweets. If a connection is already open, then it may be
     * re-opened to use new keywords.
     *
     * @throws IOException on failure to open a streaming connection.
     */
    public void commit() throws IOException;

    /**
     * Stops the stream. After this method has been called, no more messages
     * will be processed.
     */
    public void close();

    /**
     * Test whether the stream is ready for streaming
     *
     * @return true if connection can be made, false otherwise.
     */
    public boolean isValid();
}