16c72c9558facb4a17f2ecfb4ad546b47cb23526
[openflowjava.git] / third-party / openflow-codec / src / main / java / org / openflow / codec / io / OFMessageInStream.java
1 /**
2  *
3  */
4 package org.openflow.codec.io;
5
6 import java.util.List;
7
8 import org.openflow.codec.protocol.OFPMessage;
9 import org.openflow.codec.protocol.factory.OFPMessageFactory;
10
11 /**
12  * Interface for reading OFMessages from a buffered stream
13  *
14  * @author Rob Sherwood (rob.sherwood@stanford.edu)
15  *
16  */
17 public interface OFMessageInStream {
18     /**
19      * Read OF messages from the stream
20      *
21      * @return a list of OF Messages, empty if no complete messages are
22      *         available, null if the stream has closed
23      */
24     public List<OFPMessage> read() throws java.io.IOException;
25
26     /**
27      * Read OF messages from the stream
28      *
29      * @param limit
30      *            The maximum number of messages to read: 0 means all that are
31      *            buffered
32      * @return a list of OF Messages, empty if no complete messages are
33      *         available, null if the stream has closed
34      *
35      */
36     public List<OFPMessage> read(int limit) throws java.io.IOException;
37
38     /**
39      * Sets the OFPMessageFactory used to create messages on this stream
40      *
41      * @param factory
42      */
43     public void setMessageFactory(OFPMessageFactory factory);
44
45     /**
46      * Returns the OFPMessageFactory used to create messages on this stream
47      *
48      * @return
49      */
50     public OFPMessageFactory getMessageFactory();
51 }