Added OFBufferId class to represent OF buffer ids
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index d011c96..1dfb265 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -310,6 +310,7 @@
 meter_features = JType("OFMeterFeatures")\
         .op(read="OFMeterFeaturesVer$version.READER.readFrom(bb)", write="$name.writeTo(bb)")
 
+
 port_speed = JType("PortSpeed")
 boolean = JType("boolean")
 
@@ -454,6 +455,9 @@
     elif field_name == "version" and c_type == "uint8_t":
         return JType("OFVersion", 'byte') \
             .op(read='bb.readByte()', write='bb.writeByte($name)')
+    elif field_name == "buffer_id" and c_type == "uint32_t":
+        return JType("OFBufferId") \
+            .op(read="OFBufferId.of(bb.readInt())", write="bb.writeInt($name.getInt())")
     elif c_type in default_mtype_to_jtype_convert_map:
         return default_mtype_to_jtype_convert_map[c_type]
     elif re.match(r'list\(of_([a-zA-Z_]+)_t\)', c_type):
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
new file mode 100644
index 0000000..2689f93
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
@@ -0,0 +1,67 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.annotations.Immutable;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+/**
+ * Abstraction of a buffer id in OpenFlow. Immutable.
+ *
+ * @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
+ */
+@Immutable
+public class OFBufferId {
+
+    public static final OFBufferId NO_BUFFER = new OFBufferId(0xFFFFFFFF);
+
+    private final int rawValue;
+
+    private OFBufferId(int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static OFBufferId of(final int rawValue) {
+        if (rawValue == NO_BUFFER.getInt())
+            return NO_BUFFER;
+        return new OFBufferId(rawValue);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public String toString() {
+        return Long.toString(U32.f(rawValue));
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(this.rawValue);
+    }
+
+    public static OFBufferId read4Bytes(ChannelBuffer c) throws OFParseError {
+        return OFBufferId.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OFBufferId other = (OFBufferId) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+}
diff --git a/test_data/of10/packet_in.data b/test_data/of10/packet_in.data
index bd89cf8..a8de82c 100644
--- a/test_data/of10/packet_in.data
+++ b/test_data/of10/packet_in.data
@@ -30,7 +30,7 @@
 -- java
 builder
    .setXid(0x12345678)
-   .setBufferId(0xabcdef01L)
+   .setBufferId(OFBufferId.of(0xabcdef01))
    .setTotalLen(9)
    .setInPort(OFPort.LOCAL)
    .setReason(OFPacketInReason.ACTION)
diff --git a/test_data/of13/flow_add.data b/test_data/of13/flow_add.data
index 049d797..80f61e5 100644
--- a/test_data/of13/flow_add.data
+++ b/test_data/of13/flow_add.data
@@ -80,7 +80,7 @@
     .setIdleTimeout(5)
     .setHardTimeout(10)
     .setPriority(6000)
-    .setBufferId(50)
+    .setBufferId(OFBufferId.of(50))
     .setOutPort(OFPort.of(6))
     .setOutGroup(8)
     .setFlags(ImmutableSet.<OFFlowModFlags>of())
diff --git a/test_data/of13/flow_delete.data b/test_data/of13/flow_delete.data
index 268304c..afbc83a 100644
--- a/test_data/of13/flow_delete.data
+++ b/test_data/of13/flow_delete.data
@@ -80,7 +80,7 @@
     .setIdleTimeout(5)
     .setHardTimeout(10)
     .setPriority(6000)
-    .setBufferId(50)
+    .setBufferId(OFBufferId.of(50))
     .setOutPort(OFPort.of(6))
     .setOutGroup(8)
     .setFlags(ImmutableSet.<OFFlowModFlags>of())
diff --git a/test_data/of13/flow_delete_strict.data b/test_data/of13/flow_delete_strict.data
index 6165405..845b2da 100644
--- a/test_data/of13/flow_delete_strict.data
+++ b/test_data/of13/flow_delete_strict.data
@@ -80,7 +80,7 @@
     .setIdleTimeout(5)
     .setHardTimeout(10)
     .setPriority(6000)
-    .setBufferId(50)
+    .setBufferId(OFBufferId.of(50))
     .setOutPort(OFPort.of(6))
     .setOutGroup(8)
     .setFlags(ImmutableSet.<OFFlowModFlags>of())
diff --git a/test_data/of13/flow_modify.data b/test_data/of13/flow_modify.data
index 188ab3d..d382610 100644
--- a/test_data/of13/flow_modify.data
+++ b/test_data/of13/flow_modify.data
@@ -80,7 +80,7 @@
     .setIdleTimeout(5)
     .setHardTimeout(10)
     .setPriority(6000)
-    .setBufferId(50)
+    .setBufferId(OFBufferId.of(50))
     .setOutPort(OFPort.of(6))
     .setOutGroup(8)
     .setFlags(ImmutableSet.<OFFlowModFlags>of())
diff --git a/test_data/of13/flow_modify_strict.data b/test_data/of13/flow_modify_strict.data
index a40210a..6b88972 100644
--- a/test_data/of13/flow_modify_strict.data
+++ b/test_data/of13/flow_modify_strict.data
@@ -80,7 +80,7 @@
     .setIdleTimeout(5)
     .setHardTimeout(10)
     .setPriority(6000)
-    .setBufferId(50)
+    .setBufferId(OFBufferId.of(50))
     .setOutPort(OFPort.of(6))
     .setOutGroup(8)
     .setFlags(ImmutableSet.<OFFlowModFlags>of())
diff --git a/test_data/of13/packet_in.data b/test_data/of13/packet_in.data
index 1ec0422..b32bbee 100644
--- a/test_data/of13/packet_in.data
+++ b/test_data/of13/packet_in.data
@@ -33,7 +33,7 @@
 -- java
 builder
    .setXid(0x12345678)
-   .setBufferId(100)
+   .setBufferId(OFBufferId.of(100))
    .setTotalLen(17000)
    .setReason(OFPacketInReason.ACTION)
    .setTableId((byte) 20)