public class ServerSentEvent
extends java.lang.Object
implements io.netty.buffer.ByteBufHolder
ServerSentEvent
is of the type ServerSentEvent.Type.Data
unless it is explicitly passed on creation.
ByteBufHolder
so it is required to be explicitly released by calling
release()
when this instance is no longer required.Modifier and Type | Class and Description |
---|---|
static class |
ServerSentEvent.Type |
Modifier | Constructor and Description |
---|---|
|
ServerSentEvent(io.netty.buffer.ByteBuf data) |
|
ServerSentEvent(io.netty.buffer.ByteBuf eventId,
io.netty.buffer.ByteBuf eventType,
io.netty.buffer.ByteBuf data) |
|
ServerSentEvent(ServerSentEvent.Type type,
io.netty.buffer.ByteBuf data) |
protected |
ServerSentEvent(ServerSentEvent.Type type,
io.netty.buffer.ByteBuf eventId,
io.netty.buffer.ByteBuf eventType,
io.netty.buffer.ByteBuf data) |
Modifier and Type | Method and Description |
---|---|
io.netty.buffer.ByteBuf |
content() |
java.lang.String |
contentAsString() |
io.netty.buffer.ByteBufHolder |
copy() |
io.netty.buffer.ByteBufHolder |
duplicate() |
io.netty.buffer.ByteBuf |
getEventId() |
java.lang.String |
getEventIdAsString() |
io.netty.buffer.ByteBuf |
getEventType() |
java.lang.String |
getEventTypeAsString() |
protected java.nio.charset.Charset |
getSseCharset() |
ServerSentEvent.Type |
getType()
The type of this event.
|
boolean |
hasEventId() |
boolean |
hasEventType() |
int |
refCnt() |
boolean |
release() |
boolean |
release(int decrement) |
io.netty.buffer.ByteBufHolder |
retain() |
io.netty.buffer.ByteBufHolder |
retain(int increment) |
io.netty.buffer.ByteBufHolder |
touch() |
io.netty.buffer.ByteBufHolder |
touch(java.lang.Object hint) |
static ServerSentEvent |
withEventId(io.netty.buffer.ByteBuf eventId,
io.netty.buffer.ByteBuf data)
Creates a
ServerSentEvent instance with an event id. |
static ServerSentEvent |
withEventIdAndType(io.netty.buffer.ByteBuf eventId,
io.netty.buffer.ByteBuf eventType,
io.netty.buffer.ByteBuf data)
Creates a
ServerSentEvent instance with an event id and type. |
static ServerSentEvent |
withEventType(io.netty.buffer.ByteBuf eventType,
io.netty.buffer.ByteBuf data)
Creates a
ServerSentEvent instance with an event type. |
public ServerSentEvent(ServerSentEvent.Type type, io.netty.buffer.ByteBuf data)
public ServerSentEvent(io.netty.buffer.ByteBuf data)
public ServerSentEvent(io.netty.buffer.ByteBuf eventId, io.netty.buffer.ByteBuf eventType, io.netty.buffer.ByteBuf data)
protected ServerSentEvent(ServerSentEvent.Type type, io.netty.buffer.ByteBuf eventId, io.netty.buffer.ByteBuf eventType, io.netty.buffer.ByteBuf data)
public ServerSentEvent.Type getType()
ServerSentEvent.Type.Data
. The type will be ServerSentEvent.Type.Id
or ServerSentEvent.Type.EventType
only if the event just contains the
event type or event id and no data.public boolean hasEventId()
public boolean hasEventType()
public io.netty.buffer.ByteBuf getEventId()
public java.lang.String getEventIdAsString()
public io.netty.buffer.ByteBuf getEventType()
public java.lang.String getEventTypeAsString()
public java.lang.String contentAsString()
public io.netty.buffer.ByteBuf content()
content
in interface io.netty.buffer.ByteBufHolder
public io.netty.buffer.ByteBufHolder copy()
copy
in interface io.netty.buffer.ByteBufHolder
public io.netty.buffer.ByteBufHolder duplicate()
duplicate
in interface io.netty.buffer.ByteBufHolder
public int refCnt()
refCnt
in interface io.netty.util.ReferenceCounted
public io.netty.buffer.ByteBufHolder touch()
touch
in interface io.netty.buffer.ByteBufHolder
touch
in interface io.netty.util.ReferenceCounted
public io.netty.buffer.ByteBufHolder touch(java.lang.Object hint)
touch
in interface io.netty.buffer.ByteBufHolder
touch
in interface io.netty.util.ReferenceCounted
public io.netty.buffer.ByteBufHolder retain()
retain
in interface io.netty.buffer.ByteBufHolder
retain
in interface io.netty.util.ReferenceCounted
public io.netty.buffer.ByteBufHolder retain(int increment)
retain
in interface io.netty.buffer.ByteBufHolder
retain
in interface io.netty.util.ReferenceCounted
public boolean release()
release
in interface io.netty.util.ReferenceCounted
public boolean release(int decrement)
release
in interface io.netty.util.ReferenceCounted
public static ServerSentEvent withEventId(io.netty.buffer.ByteBuf eventId, io.netty.buffer.ByteBuf data)
ServerSentEvent
instance with an event id.eventId
- Id for the event.data
- Data for the event.ServerSentEvent
instance.public static ServerSentEvent withEventType(io.netty.buffer.ByteBuf eventType, io.netty.buffer.ByteBuf data)
ServerSentEvent
instance with an event type.eventType
- Type for the event.data
- Data for the event.ServerSentEvent
instance.public static ServerSentEvent withEventIdAndType(io.netty.buffer.ByteBuf eventId, io.netty.buffer.ByteBuf eventType, io.netty.buffer.ByteBuf data)
ServerSentEvent
instance with an event id and type.eventType
- Type for the event.eventId
- Id for the event.data
- Data for the event.ServerSentEvent
instance.protected java.nio.charset.Charset getSseCharset()