org.red5.server.net.rtmp.event

## Class BaseEvent

- java.lang.Object
- - org.red5.server.net.rtmp.event.BaseEvent

All Implemented Interfaces:
  Externalizable, Serializable, IEvent, IRTMPEvent, Constants

Direct Known Subclasses:
  Abort, Aggregate, AudioData, BytesRead, ChunkSize, ClientBW, Notify, Ping, ServerBW, SharedObjectMessage, Unknown, VideoData

    public abstract class BaseEvent
    extends Object
    implements Constants, IRTMPEvent, Externalizable

Base abstract class for all RTMP events

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.red5.server.api.event.IEvent

`IEvent.Type`

### Field Summary

Fields
`protected Header` `header` Event RTMP packet header
`protected Object` `object` Event target object
`protected AtomicInteger` `refcount` Event references count
`protected IEventListener` `source` Event listener
`protected int` `timestamp` Event timestamp

### Fields inherited from interface org.red5.server.net.rtmp.message.Constants

`HANDSHAKE_SIZE, HEADER_CONTINUE, HEADER_NEW, HEADER_SAME_SOURCE, HEADER_TIMER_CHANGE, MEDIUM_INT_MAX, SO_CLIENT_CLEAR_DATA, SO_CLIENT_DELETE_DATA, SO_CLIENT_INITIAL_DATA, SO_CLIENT_SEND_MESSAGE, SO_CLIENT_STATUS, SO_CLIENT_UPDATE_ATTRIBUTE, SO_CLIENT_UPDATE_DATA, SO_CONNECT, SO_DELETE_ATTRIBUTE, SO_DISCONNECT, SO_SEND_MESSAGE, SO_SET_ATTRIBUTE, SOURCE_TYPE_LIVE, SOURCE_TYPE_VOD, TYPE_ABORT, TYPE_AGGREGATE, TYPE_AUDIO_DATA, TYPE_BYTES_READ, TYPE_CHUNK_SIZE, TYPE_CLIENT_BANDWIDTH, TYPE_EDGE_ORIGIN, TYPE_FLEX_MESSAGE, TYPE_FLEX_SHARED_OBJECT, TYPE_FLEX_STREAM_SEND, TYPE_INVOKE, TYPE_NOTIFY, TYPE_PING, TYPE_SERVER_BANDWIDTH, TYPE_SHARED_OBJECT, TYPE_STREAM_METADATA, TYPE_VIDEO_DATA`

### Constructor Summary

Constructors
Constructor and Description
`BaseEvent()`
`BaseEvent(IEvent.Type type)` Create new event of given type
`BaseEvent(IEvent.Type type, IEventListener source)` Create new event of given type

### Method Summary

Methods
`abstract byte` `getDataType()` Getter for data type
`Header` `getHeader()` Getter for header
`Object` `getObject()` Returns event context object
`IEventListener` `getSource()` Returns event listener
`byte` `getSourceType()` Getter for source type
`int` `getTimestamp()` Getter for timestamp
`IEvent.Type` `getType()` Returns even type
`boolean` `hasSource()` Whether event has source (event listener(s))
`void` `readExternal(ObjectInput in)`
`void` `release()` Hook to free buffers allocated by the event.
`protected abstract void` `releaseInternal()` Release event
`void` `retain()` Retain event
`void` `setHeader(Header header)` Setter for header
`void` `setSource(IEventListener source)` Setter for source
`void` `setSourceType(byte sourceType)` Setter for source type
`void` `setTimestamp(int timestamp)` Setter for timestamp
`void` `setType(IEvent.Type type)`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### object

    protected Object object

Event target object

#### source

    protected IEventListener source

Event listener

#### timestamp

    protected int timestamp

Event timestamp

#### header

    protected Header header

Event RTMP packet header

#### refcount

    protected AtomicInteger refcount

Event references count

### Constructor Detail

#### BaseEvent

    public BaseEvent()

#### BaseEvent

    public BaseEvent(IEvent.Type type)

Create new event of given type

Parameters:
  `type` - Event type

#### BaseEvent

    public BaseEvent(IEvent.Type type,
             IEventListener source)

Create new event of given type

Parameters:
  `type` - Event type
  `source` - Event source

### Method Detail

#### getType

    public IEvent.Type getType()

Returns even type

Specified by:
  `getType` in interface `IEvent`
Returns:
  Event type enumeration

#### setType

    public void setType(IEvent.Type type)

#### getSourceType

    public byte getSourceType()

Description copied from interface: `IRTMPEvent`
Getter for source type

Specified by:
  `getSourceType` in interface `IRTMPEvent`
Returns:
  Source type

#### setSourceType

    public void setSourceType(byte sourceType)

Description copied from interface: `IRTMPEvent`
Setter for source type

Specified by:
  `setSourceType` in interface `IRTMPEvent`

#### getObject

    public Object getObject()

Returns event context object

Specified by:
  `getObject` in interface `IEvent`
Returns:
  Event context object

#### getHeader

    public Header getHeader()

Getter for header

Specified by:
  `getHeader` in interface `IRTMPEvent`
Returns:
  RTMP packet header

#### setHeader

    public void setHeader(Header header)

Setter for header

Specified by:
  `setHeader` in interface `IRTMPEvent`
Parameters:
  `header` - RTMP packet header

#### hasSource

    public boolean hasSource()

Whether event has source (event listener(s))

Specified by:
  `hasSource` in interface `IEvent`
Returns:
  `true` if so, `false` otherwise

#### getSource

    public IEventListener getSource()

Returns event listener

Specified by:
  `getSource` in interface `IEvent`
Returns:
  Event listener object

#### setSource

    public void setSource(IEventListener source)

Setter for source

Specified by:
  `setSource` in interface `IRTMPEvent`
Parameters:
  `source` - Source

#### getDataType

    public abstract byte getDataType()

Getter for data type

Specified by:
  `getDataType` in interface `IRTMPEvent`
Returns:
  Data type

#### getTimestamp

    public int getTimestamp()

Getter for timestamp

Specified by:
  `getTimestamp` in interface `IRTMPEvent`
Returns:
  Event timestamp

#### setTimestamp

    public void setTimestamp(int timestamp)

Setter for timestamp

Specified by:
  `setTimestamp` in interface `IRTMPEvent`
Parameters:
  `timestamp` - New event timestamp

#### retain

    public void retain()

Retain event

Specified by:
  `retain` in interface `IRTMPEvent`

#### release

    public void release()

Hook to free buffers allocated by the event.

Specified by:
  `release` in interface `IRTMPEvent`

#### releaseInternal

    protected abstract void releaseInternal()

Release event

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`