Initial opendaylight infrastructure commit!!
[controller.git] / third-party / openflowj / src / main / java / org / openflow / io / OFMessageOutStream.java
diff --git a/third-party/openflowj/src/main/java/org/openflow/io/OFMessageOutStream.java b/third-party/openflowj/src/main/java/org/openflow/io/OFMessageOutStream.java
new file mode 100644 (file)
index 0000000..56416ce
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+ *
+ */
+package org.openflow.io;
+
+import java.util.List;
+import org.openflow.protocol.OFMessage;
+
+/**
+ * Interface for writing OFMessages to a buffered stream
+ *
+ * @author Rob Sherwood (rob.sherwood@stanford.edu)
+ *
+ */
+public interface OFMessageOutStream {
+    /**
+     * Write an OpenFlow message to the stream
+     * @param m An OF Message
+     */
+    public void write(OFMessage m) throws java.io.IOException;
+
+    /**
+     * Write an OpenFlow message to the stream.
+     *  Messages are sent in one large write() for efficiency
+     * @param l A list of OF Messages
+     */
+    public void write(List<OFMessage> l) throws java.io.IOException;
+
+    /**
+     * Pushes buffered data out the Stream; this is NOT guranteed to flush all
+     * data, multiple flush() calls may be required, until needFlush() returns
+     * false.
+     */
+    public void flush() throws java.io.IOException;
+
+    /**
+     * Is there buffered data that needs to be flushed?
+     * @return true if there is buffered data and flush() should be called
+     */
+    public boolean needsFlush();
+}