001package com.box.sdk; 002 003/** The listener interface for receiving events from an {@link EventStream}. */ 004public interface EventListener { 005 /** 006 * Invoked when an event is received from the API. 007 * 008 * @param event the received event. 009 */ 010 void onEvent(BoxEvent event); 011 012 /** 013 * Invoked when an updated stream position is received from the API. 014 * 015 * @param position of the stream. 016 */ 017 void onNextPosition(long position); 018 019 /** 020 * Invoked when an error occurs while waiting for events to be received. 021 * 022 * <p>When an EventStream encounters an exception, it will invoke this method on each of its 023 * listeners until one of them returns true, indicating that the exception was handled. 024 * 025 * @param e the exception that was thrown while waiting for events. 026 * @return true if the exception was handled; otherwise false. 027 */ 028 boolean onException(Throwable e); 029}