
package galileo.event;

import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;

import java.io.IOException;

import galileo.net.GalileoMessage;
import galileo.serialization.SerializationOutputStream;

public class EventWrapper {

    public static GalileoMessage wrap(Event e)
    throws IOException {
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        SerializationOutputStream sOut = new SerializationOutputStream(
                new BufferedOutputStream(bOut));

        sOut.writeInt(e.getTypeMap().toInt());
        sOut.writeSerializable(e);
        sOut.close();

        byte[] payload = bOut.toByteArray();
        GalileoMessage msg = new GalileoMessage(payload);
        return msg;
    }
}

@@ -1,747 +1,1921 @@
-%0Apackage galileo.event;%0A%0Aimport java.io.BufferedOutputStream;%0Aimport java.io.ByteArrayOutputStream;%0A%0Aimport java.io.IOException;%0A%0Aimport galileo.net.GalileoMessage;%0Aimport galileo.serialization.SerializationOutputStream;%0A%0Apublic class EventWrapper %7B%0A%0A    public static GalileoMessage wrap(Event e)%0A    throws IOException %7B%0A        ByteArrayOutputStream bOut = new ByteArrayOutputStream();%0A        SerializationOutputStream sOut = new SerializationOutputStream(%0A                new BufferedOutputStream(bOut));%0A%0A        sOut.writeInt(e.getTypeMap().toInt());%0A        sOut.writeSerializable(e);%0A        sOut.close();%0A%0A        byte%5B%5D payload = bOut.toByteArray();%0A        GalileoMessage msg = new GalileoMessage(payload);%0A        return
+/*%0ACopyright (c) 2014, Colorado State University%0AAll rights reserved.%0A%0ARedistribution and use in source and binary forms, with or without modification,%0Aare permitted provided that the following conditions are met:%0A%0A1. Redistributions of source code must retain the above copyright notice, this%0A   list of conditions and the following disclaimer.%0A2. Redistributions in binary form must reproduce the above copyright notice,%0A   this list of conditions and the following disclaimer in the documentation%0A   and/or other materials provided with the distribution.%0A%0AThis software is provided by the copyright holders and contributors %22as is%22 and%0Aany express or implied warranties, including, but not limited to, the implied%0Awarranties of merchantability and fitness for a particular purpose are%0Adisclaimed. In no event shall the copyright holder or contributors be liable for%0Aany direct, indirect, incidental, special, exemplary, or consequential damages%0A(including, but not limited to, procurement of substitute goods or services;%0Aloss of use, data, or profits; or business interruption) however caused and on%0Aany theory of liability, whether in contract, strict liability, or tort%0A(including negligence or otherwise) arising in any way out of the use of this%0Asoftware, even if advised of the possibility of such damage.%0A*/%0A%0Apackage galileo.event;%0A%0Aimport java.io.IOException;%0A%0Aimport galileo.net.GalileoMessage;%0A%0A/**%0A * Defines how Events are wrapped and unwrapped for serialization and%0A * transmission across the network.%0A *%0A * @author malensek%0A */%0Apublic interface EventWrapper %7B%0A%0A    /**%0A     * Wraps an %7B@link Event%7D up in a %7B@link GalileoMessage%7D, ready to be%0A     * transmitted across the network.%0A     */%0A    public GalileoMessage wrap(Event e) throws IOException;%0A%0A    /**%0A     * Unwraps a %7B@link GalileoMessage%7D to extract the %7B@link Event%7D it%0A     * contains.%0A     */%0A    public Event unwrap(GalileoMessage
  msg
+)
 ;%0A
-    %7D
 %0A%7D%0A

Make EventWrapper an interface