67d753d35feeb614ef89aa151909681c21d8f51b
[openflowjava.git] / third-party / openflow-codec / src / main / java / org / openflow / codec / io / OFMessageOutStream.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
10 /**
11  * Interface for writing OFMessages to a buffered stream
12  *
13  * @author Rob Sherwood (rob.sherwood@stanford.edu)
14  *
15  */
16 public interface OFMessageOutStream {
17     /**
18      * Write an OpenFlow message to the stream
19      *
20      * @param m
21      *            An OF Message
22      */
23     public void write(OFPMessage m) throws java.io.IOException;
24
25     /**
26      * Write an OpenFlow message to the stream. Messages are sent in one large
27      * write() for efficiency
28      *
29      * @param l
30      *            A list of OF Messages
31      */
32     public void write(List<OFPMessage> l) throws java.io.IOException;
33
34     /**
35      * Pushes buffered data out the Stream; this is NOT guranteed to flush all
36      * data, multiple flush() calls may be required, until needFlush() returns
37      * false.
38      */
39     public void flush() throws java.io.IOException;
40
41     /**
42      * Is there buffered data that needs to be flushed?
43      *
44      * @return true if there is buffered data and flush() should be called
45      */
46     public boolean needsFlush();
47 }