@@ -0,0 +1,2921 @@
+/*%0A * Copyright 2010-2011 Ning, Inc.%0A *%0A * Ning licenses this file to you under the Apache License, version 2.0%0A * (the %22License%22); you may not use this file except in compliance with the%0A * License.  You may obtain a copy of the License at:%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the%0A * License for the specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage com.ning.metrics.serialization.event;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.ObjectInputStream;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Events%0A%7B%0A    /**%0A     * Given a file written by the serialization-writer library, extract all events.%0A     * This assumes the file was written using ObjectOutputStream.%0A     *%0A     * @param file file to deserialize%0A     * @return events contained in the file%0A     * @throws java.io.IOException    generic IOException%0A     * @throws ClassNotFoundException if the underlying Event class is not in the classpath%0A     */%0A    public static List%3CEvent%3E fromFile(final File file) throws IOException, ClassNotFoundException%0A    %7B%0A        return fromInputStream(new FileInputStream(file));%0A    %7D%0A%0A    /**%0A     * Given a stream written by the serialization-writer library, extract all events.%0A     * This assumes the file was written using ObjectOutputStream.%0A     *%0A     * @param stream stream to deserialize%0A     * @return events contained in the file%0A     * @throws java.io.IOException    generic IOException%0A     * @throws ClassNotFoundException if the underlying Event class is not in the classpath%0A     */%0A    public static List%3CEvent%3E fromInputStream(final InputStream stream) throws IOException, ClassNotFoundException%0A    %7B%0A        return fromObjectInputStream(new ObjectInputStream(stream));%0A    %7D%0A%0A    /**%0A     * Given a stream written by the serialization-writer library, extract all events.%0A     * This assumes the file was written using ObjectOutputStream.%0A     *%0A     * @param objectInputStream stream to deserialize%0A     * @return events contained in the file%0A     * @throws java.io.IOException    generic IOException%0A     * @throws ClassNotFoundException if the underlying Event class is not in the classpath%0A     */%0A    public static List%3CEvent%3E fromObjectInputStream(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException%0A    %7B%0A        final ArrayList%3CEvent%3E events = new ArrayList%3CEvent%3E();%0A%0A        while (objectInputStream.read() != -1) %7B%0A            Event e = (Event) objectInputStream.readObject();%0A            events.add(e);%0A        %7D%0A        objectInputStream.close();%0A%0A        return events;%0A    %7D%0A%7D%0A

add Events class