private void writeObject(ObjectOutputStream stream)
            throws IOException {
        stream.writeObject(beforeWindowData);
        stream.writeObject(onAfterWindowData);
        stream.writeObject(outputData);
        stream.writeObject(type);
        stream.writeLong(timestamp);
        StreamEvent nextEvent = next;
        while (nextEvent != null) {
            stream.writeBoolean(true);
            stream.writeObject(nextEvent.beforeWindowData);
            stream.writeObject(nextEvent.onAfterWindowData);
            stream.writeObject(nextEvent.outputData);
            stream.writeObject(nextEvent.type);
            stream.writeLong(nextEvent.timestamp);
            nextEvent = nextEvent.getNext();
        }
        stream.writeBoolean(false);
    }
@param position int array of 4 elements
                position[0] and position[1] are discarded
                position[2]-BeforeWindowData or OutputData or AfterWindowData, position[3]- which attribute
@return attribute
modules/siddhi-core/src/main/java/io/siddhi/core/event/stream/StreamEvent.java