public StateEvent copyStateEvent(StateEvent stateEvent) {
        StateEvent newEvent = stateEventFactory.newInstance();
        if (outputDataSize > 0) {
            System.arraycopy(stateEvent.getOutputData(), 0, newEvent.getOutputData(), 0, outputDataSize);
        }
        if (streamEventSize > 0) {
            System.arraycopy(stateEvent.getStreamEvents(), 0, newEvent.getStreamEvents(), 0, streamEventSize);
        }
        newEvent.setType(stateEvent.getType());
        newEvent.setTimestamp(stateEvent.getTimestamp());
        newEvent.setId(stateEvent.getId());
        return newEvent;
    }
Method to copy new StreamEvent from StreamEvent

@param stateEvent StreamEvent to be copied
@return StateEvent
modules/siddhi-core/src/main/java/io/siddhi/core/event/state/StateEventCloner.java