Package renaming - missed the pre-written files in the previous commit.
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java
new file mode 100644
index 0000000..ea2c4a9
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java
@@ -0,0 +1,67 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.base.Charsets;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtils {
+    public static String readFixedLengthString(ChannelBuffer bb, int length) {
+        byte[] dst = new byte[length];
+        bb.readBytes(dst, 0, length);
+        return new String(dst, Charsets.US_ASCII);
+    }
+
+    public static void writeFixedLengthString(ChannelBuffer bb, String string,
+            int length) {
+        int l = string.length();
+        if (l > length) {
+            throw new IllegalArgumentException("Error writing string: length="
+                    + l + " > max Length=" + length);
+        }
+        bb.writeBytes(string.getBytes(Charsets.US_ASCII));
+        if (l < length) {
+            bb.writeZero(length - l);
+        }
+    }
+
+    static public byte[] readBytes(final ChannelBuffer bb, final int length) {
+        byte byteArray[] = new byte[length];
+        bb.readBytes(byteArray);
+        return byteArray;
+    }
+
+    static public void writeBytes(final ChannelBuffer bb,
+            final byte byteArray[]) {
+        bb.writeBytes(byteArray);
+    }
+
+    public static <T> List<T> readList(ChannelBuffer bb, int length, OFMessageReader<T> reader) throws OFParseError {
+        int end = bb.readerIndex() + length;
+        Builder<T> builder = ImmutableList.<T>builder();
+        while(bb.readerIndex() < end) {
+            builder.add(reader.readFrom(bb));
+        }
+        if(bb.readerIndex() != end) {
+            throw new IllegalStateException("Overread length: length="+length + " overread by "+ (bb.readerIndex() - end) + " reader: "+reader);
+        }
+        return builder.build();
+    }
+
+    public static void writeList(ChannelBuffer bb, List<? extends Writeable> writeables) {
+        for(Writeable w: writeables)
+            w.writeTo(bb);
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java
new file mode 100644
index 0000000..d812236
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/HexString.java
@@ -0,0 +1,98 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import java.math.BigInteger;
+
+import org.projectfloodlight.openflow.types.U8;
+
+public class HexString {
+    /**
+     * Convert a string of bytes to a ':' separated hex string
+     *
+     * @param bytes
+     * @return "0f:ca:fe:de:ad:be:ef"
+     */
+    public static String toHexString(final byte[] bytes) {
+        int i;
+        String ret = "";
+        String tmp;
+        for (i = 0; i < bytes.length; i++) {
+            if (i > 0)
+                ret += ":";
+            tmp = Integer.toHexString(U8.f(bytes[i]));
+            if (tmp.length() == 1)
+                ret += "0";
+            ret += tmp;
+        }
+        return ret;
+    }
+
+    public static String toHexString(final long val, final int padTo) {
+        char arr[] = Long.toHexString(val).toCharArray();
+        String ret = "";
+        // prepend the right number of leading zeros
+        int i = 0;
+        for (; i < (padTo * 2 - arr.length); i++) {
+            ret += "0";
+            if ((i % 2) == 1)
+                ret += ":";
+        }
+        for (int j = 0; j < arr.length; j++) {
+            ret += arr[j];
+            if ((((i + j) % 2) == 1) && (j < (arr.length - 1)))
+                ret += ":";
+        }
+        return ret;
+    }
+
+    public static String toHexString(final long val) {
+        return toHexString(val, 8);
+    }
+
+    /**
+     * Convert a string of hex values into a string of bytes
+     *
+     * @param values
+     *            "0f:ca:fe:de:ad:be:ef"
+     * @return [15, 5 ,2, 5, 17]
+     * @throws NumberFormatException
+     *             If the string can not be parsed
+     */
+    public static byte[] fromHexString(final String values) throws NumberFormatException {
+        String[] octets = values.split(":");
+        byte[] ret = new byte[octets.length];
+
+        for (int i = 0; i < octets.length; i++) {
+            if (octets[i].length() > 2)
+                throw new NumberFormatException("Invalid octet length");
+            ret[i] = Integer.valueOf(octets[i], 16).byteValue();
+        }
+        return ret;
+    }
+
+    public static long toLong(final String values) throws NumberFormatException {
+        // Long.parseLong() can't handle HexStrings with MSB set. Sigh.
+        BigInteger bi = new BigInteger(values.replaceAll(":", ""), 16);
+        if (bi.bitLength() > 64)
+            throw new NumberFormatException("Input string too big to fit in long: "
+                    + values);
+        return bi.longValue();
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java
new file mode 100644
index 0000000..7798e67
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java
@@ -0,0 +1,42 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import java.util.LinkedHashMap;
+
+public class LRULinkedHashMap<K, V> extends LinkedHashMap<K, V> {
+    private static final long serialVersionUID = -2964986094089626647L;
+    protected int maximumCapacity;
+
+    public LRULinkedHashMap(final int initialCapacity, final int maximumCapacity) {
+        super(initialCapacity, 0.75f, true);
+        this.maximumCapacity = maximumCapacity;
+    }
+
+    public LRULinkedHashMap(final int maximumCapacity) {
+        super(16, 0.75f, true);
+        this.maximumCapacity = maximumCapacity;
+    }
+
+    @Override
+    protected boolean removeEldestEntry(final java.util.Map.Entry<K, V> eldest) {
+        if (this.size() > maximumCapacity)
+            return true;
+        return false;
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java
new file mode 100644
index 0000000..48362da
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java
@@ -0,0 +1,673 @@
+package org.projectfloodlight.openflow.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.Charset;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferFactory;
+import org.jboss.netty.buffer.ChannelBufferIndexFinder;
+
+public class LengthCountingPseudoChannelBuffer implements ChannelBuffer {
+
+    int writerIndex = 0;
+    private int markedWriterIndex;
+
+    @Override
+    public ChannelBufferFactory factory() {
+        return null;
+    }
+
+    @Override
+    public int capacity() {
+        return Integer.MAX_VALUE;
+    }
+
+    @Override
+    public ByteOrder order() {
+        return ByteOrder.BIG_ENDIAN;
+    }
+
+    @Override
+    public boolean isDirect() {
+        return true;
+    }
+
+    @Override
+    public int readerIndex() {
+        return 0;
+    }
+
+    @Override
+    public void readerIndex(int readerIndex) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int writerIndex() {
+        return writerIndex;
+    }
+
+    @Override
+    public void writerIndex(int writerIndex) {
+        this.writerIndex = writerIndex;
+    }
+
+    @Override
+    public void setIndex(int readerIndex, int writerIndex) {
+        if(readerIndex != 0)
+            throw new UnsupportedOperationException();
+        this.writerIndex = writerIndex;
+    }
+
+    @Override
+    public int readableBytes() {
+        return writerIndex;
+    }
+
+    @Override
+    public int writableBytes() {
+        return Integer.MAX_VALUE - writerIndex;
+    }
+
+    @Override
+    public boolean readable() {
+        return writerIndex > 0;
+    }
+
+    @Override
+    public boolean writable() {
+        return writerIndex < Integer.MAX_VALUE;
+    }
+
+    @Override
+    public void clear() {
+        writerIndex = 0;
+
+    }
+
+    @Override
+    public void markReaderIndex() {
+    }
+
+    @Override
+    public void resetReaderIndex() {
+    }
+
+    @Override
+    public void markWriterIndex() {
+        markedWriterIndex = writerIndex;
+    }
+
+    @Override
+    public void resetWriterIndex() {
+        writerIndex = markedWriterIndex;
+    }
+
+    @Override
+    public void discardReadBytes() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void ensureWritableBytes(int writableBytes) {
+        if(!((Integer.MAX_VALUE - writableBytes) > writerIndex))
+            throw new IllegalStateException();
+    }
+
+    @Override
+    public byte getByte(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short getUnsignedByte(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short getShort(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getUnsignedShort(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getMedium(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getUnsignedMedium(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getInt(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long getUnsignedInt(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long getLong(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public char getChar(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public float getFloat(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public double getDouble(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, byte[] dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, byte[] dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ByteBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, OutputStream out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getBytes(int index, GatheringByteChannel out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setByte(int index, int value) {
+    }
+
+    @Override
+    public void setShort(int index, int value) {
+    }
+
+    @Override
+    public void setMedium(int index, int value) {
+    }
+
+    @Override
+    public void setInt(int index, int value) {
+    }
+
+    @Override
+    public void setLong(int index, long value) {
+    }
+
+    @Override
+    public void setChar(int index, int value) {
+    }
+
+    @Override
+    public void setFloat(int index, float value) {
+    }
+
+    @Override
+    public void setDouble(int index, double value) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, byte[] src) {
+    }
+
+    @Override
+    public void setBytes(int index, byte[] src, int srcIndex, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, ByteBuffer src) {
+
+    }
+
+    @Override
+    public int setBytes(int index, InputStream in, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int setBytes(int index, ScatteringByteChannel in, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setZero(int index, int length) {
+    }
+
+    @Override
+    public byte readByte() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short readUnsignedByte() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short readShort() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readUnsignedShort() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readMedium() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readUnsignedMedium() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readInt() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long readUnsignedInt() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long readLong() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public char readChar() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public float readFloat() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public double readDouble() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer readBytes(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public ChannelBuffer readBytes(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer readSlice(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public
+    ChannelBuffer readSlice(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(byte[] dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(byte[] dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ByteBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(OutputStream out, int length) throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readBytes(GatheringByteChannel out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void skipBytes(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public int skipBytes(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void writeByte(int value) {
+        writerIndex++;
+    }
+
+    @Override
+    public void writeShort(int value) {
+    writerIndex += 2;
+}
+
+@Override
+public void writeMedium(int value) {
+    writerIndex += 3;
+}
+
+@Override
+public void writeInt(int value) {
+    writerIndex += 4;
+}
+
+@Override
+public void writeLong(long value) {
+    writerIndex += 8;
+}
+
+
+    @Override
+    public void writeChar(int value) {
+        writeShort(value);
+    }
+
+    @Override
+    public void writeFloat(float value) {
+        writeInt(Float.floatToIntBits(value));
+    }
+
+    @Override
+    public void writeDouble(double value) {
+        writeLong(Double.doubleToLongBits(value));
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src) {
+        writerIndex += src.readableBytes();
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src, int length) {
+        writerIndex += src.readableBytes();
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src, int srcIndex, int length) {
+        writerIndex += length;
+    }
+
+    @Override
+    public void writeBytes(byte[] src) {
+        writerIndex += src.length;
+
+    }
+
+    @Override
+    public void writeBytes(byte[] src, int srcIndex, int length) {
+        writerIndex += length;
+    }
+
+    @Override
+    public void writeBytes(ByteBuffer src) {
+        writerIndex += src.remaining();
+
+    }
+
+    @Override
+    public int writeBytes(InputStream in, int length) throws IOException {
+        writerIndex += length;
+        return length;
+    }
+
+    @Override
+    public int writeBytes(ScatteringByteChannel in, int length)
+            throws IOException {
+        writerIndex += length;
+        return length;
+    }
+
+    @Override
+    public void writeZero(int length) {
+        writerIndex += length;
+
+    }
+
+    @Override
+    public int indexOf(int fromIndex, int toIndex, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int indexOf(int fromIndex, int toIndex,
+            ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int length, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int length, ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int index, int length, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int index, int length,
+            ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer copy() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer copy(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer slice() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer slice(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer duplicate() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer toByteBuffer() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer toByteBuffer(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer[] toByteBuffers() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer[] toByteBuffers(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean hasArray() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public byte[] array() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int arrayOffset() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String toString(Charset charset) {
+        return "LengthCountingPseudoChannelBuffer(length="+writerIndex+")";
+    }
+
+    @Override
+    public String toString(int index, int length, Charset charset) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(String charsetName) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(String charsetName,
+            ChannelBufferIndexFinder terminatorFinder) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(int index, int length, String charsetName) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public
+    String toString(int index, int length, String charsetName,
+            ChannelBufferIndexFinder terminatorFinder) {
+        return toString();
+    }
+
+    @Override
+    public int compareTo(ChannelBuffer buffer) {
+        throw new UnsupportedOperationException();
+
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java
new file mode 100644
index 0000000..6949fb2
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java
@@ -0,0 +1,58 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public class StringByteSerializer {
+    public static String readFrom(final ChannelBuffer data, final int length) {
+        byte[] stringBytes = new byte[length];
+        data.readBytes(stringBytes);
+        // find the first index of 0
+        int index = 0;
+        for (byte b : stringBytes) {
+            if (0 == b)
+                break;
+            ++index;
+        }
+        return new String(Arrays.copyOf(stringBytes, index), Charset.forName("ascii"));
+    }
+
+    public static void writeTo(final ChannelBuffer data, final int length,
+            final String value) {
+        try {
+            byte[] name = value.getBytes("ASCII");
+            if (name.length < length) {
+                data.writeBytes(name);
+                for (int i = name.length; i < length; ++i) {
+                    data.writeByte((byte) 0);
+                }
+            } else {
+                data.writeBytes(name, 0, length - 1);
+                data.writeByte((byte) 0);
+            }
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+}