Initial opendaylight infrastructure commit!!
[controller.git] / third-party / openflowj / src / main / java / org / openflow / io / OFMessageInStream.java
diff --git a/third-party/openflowj/src/main/java/org/openflow/io/OFMessageInStream.java b/third-party/openflowj/src/main/java/org/openflow/io/OFMessageInStream.java
new file mode 100644 (file)
index 0000000..39ec30d
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.openflow.io;
+
+import java.util.List;
+
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.factory.OFMessageFactory;
+
+/**
+ * Interface for reading OFMessages from a buffered stream
+ * 
+ * @author Rob Sherwood (rob.sherwood@stanford.edu)
+ * 
+ */
+public interface OFMessageInStream {
+    /**
+     * Read OF messages from the stream
+     * 
+     * @return a list of OF Messages, empty if no complete messages are
+     *         available, null if the stream has closed
+     */
+    public List<OFMessage> read() throws java.io.IOException;
+
+    /**
+     * Read OF messages from the stream
+     * 
+     * @param limit
+     *            The maximum number of messages to read: 0 means all that are
+     *            buffered
+     * @return a list of OF Messages, empty if no complete messages are
+     *         available, null if the stream has closed
+     * 
+     */
+    public List<OFMessage> read(int limit) throws java.io.IOException;
+
+    /**
+     * Sets the OFMessageFactory used to create messages on this stream
+     * 
+     * @param factory
+     */
+    public void setMessageFactory(OFMessageFactory factory);
+
+    /**
+     * Returns the OFMessageFactory used to create messages on this stream
+     * 
+     * @return
+     */
+    public OFMessageFactory getMessageFactory();
+}