public final class SetupFrame extends Object
SETUP frame.Disposable.Composite, Disposable.SwapFRAME_TYPE_SHIFT| Modifier and Type | Method and Description |
|---|---|
static SetupFrame |
createSetupFrame(ByteBuf byteBuf)
Creates the
SETUP frame. |
static SetupFrame |
createSetupFrame(ByteBufAllocator byteBufAllocator,
boolean lease,
Duration keepAliveInterval,
Duration maxLifetime,
ByteBuf resumeIdentificationToken,
String metadataMimeType,
String dataMimeType,
ByteBuf metadata,
ByteBuf data)
Creates the
SETUP frame. |
static SetupFrame |
createSetupFrame(ByteBufAllocator byteBufAllocator,
boolean lease,
Duration keepAliveInterval,
Duration maxLifetime,
String resumeIdentificationToken,
String metadataMimeType,
String dataMimeType,
String metadata,
String data)
Creates the
SETUP frame. |
static SetupFrame |
createSetupFrame(ByteBufAllocator byteBufAllocator,
boolean lease,
int majorVersion,
int minorVersion,
Duration keepAliveInterval,
Duration maxLifetime,
ByteBuf resumeIdentificationToken,
String metadataMimeType,
String dataMimeType,
ByteBuf metadata,
ByteBuf data)
Creates the
SETUP frame. |
void |
dispose() |
boolean |
equals(Object o) |
String |
getDataMimeType()
Returns the data MIME-type, decoded at
StandardCharsets.UTF_8. |
String |
getDataMimeType(Charset charset)
Returns the data MIME-type.
|
FrameType |
getFrameType()
Returns the
FrameType. |
Duration |
getKeepAliveInterval()
Returns the keep alive interval.
|
int |
getMajorVersion()
Returns the major version of the protocol.
|
Duration |
getMaxLifetime()
Returns the max lifetime.
|
String |
getMetadataMimeType()
Returns the metadata MIME-type, decoded at
StandardCharsets.UTF_8. |
String |
getMetadataMimeType(Charset charset)
Returns the metadata MIME-type.
|
int |
getMinorVersion()
Returns the minor version of the protocol.
|
Optional<String> |
getResumeIdentificationTokenAsUtf8()
Returns the resume identification token as a UTF-8
String. |
ByteBuf |
getUnsafeData()
Returns the data directly.
|
ByteBuf |
getUnsafeFrame()
Returns the frame directly.
|
ByteBuf |
getUnsafeMetadata()
Returns the metadata directly.
|
ByteBuf |
getUnsafeResumeIdentificationToken()
Returns the resume identification token directly.
|
String |
getUnsafeResumeIdentificationTokenAsUtf8()
Returns the resume identification token as a UTF-8
String. |
int |
hashCode() |
boolean |
isLeaseFlagSet()
Returns whether the lease flag is set.
|
<T> Optional<T> |
mapResumeIdentificationToken(Function<ByteBuf,T> function)
Exposes the resume identification token for mapping to a different type.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetMetadataAsUtf8, getMetadataLength, getUnsafeMetadataAsUtf8, getUnsafeMetadataLength, mapMetadatagetDataAsUtf8, getDataLength, mapDataconsumeFrame, getFrameType, getUnsafeFrame, mapFramedispose, isDisposedpublic static SetupFrame createSetupFrame(ByteBuf byteBuf)
SETUP frame.byteBuf - the ByteBuf representing the frameSETUP frame.NullPointerException - if byteBuf is nullpublic static SetupFrame createSetupFrame(ByteBufAllocator byteBufAllocator, boolean lease, Duration keepAliveInterval, Duration maxLifetime, @Nullable String resumeIdentificationToken, String metadataMimeType, String dataMimeType, @Nullable String metadata, @Nullable String data)
SETUP frame.byteBufAllocator - the ByteBufAllocator to uselease - whether to set the Lease flagkeepAliveInterval - the time between KEEPALIVE framesmaxLifetime - the time between KEEPALIVE frames before the server is assumed to be
deadresumeIdentificationToken - the resume identification tokenmetadataMimeType - metadata MIME-type encodingdataMimeType - data MIME-type encodingmetadata - the metadatadata - the dataSETUP frameNullPointerException - if byteBufAllocator, keepAliveInterval, maxLifetime, metadataMimeType, or dataMimeType is nullIllegalArgumentException - if keepAliveInterval or maxLifetime is not a
positive durationpublic static SetupFrame createSetupFrame(ByteBufAllocator byteBufAllocator, boolean lease, Duration keepAliveInterval, Duration maxLifetime, @Nullable ByteBuf resumeIdentificationToken, String metadataMimeType, String dataMimeType, @Nullable ByteBuf metadata, @Nullable ByteBuf data)
SETUP frame.byteBufAllocator - the ByteBufAllocator to uselease - whether to set the Lease flagkeepAliveInterval - the time between KEEPALIVE framesmaxLifetime - the time between KEEPALIVE frames before the server is assumed to be
deadresumeIdentificationToken - the resume identification tokenmetadataMimeType - metadata MIME-type encodingdataMimeType - data MIME-type encodingmetadata - the metadatadata - the dataSETUP frameNullPointerException - if byteBufAllocator, keepAliveInterval, maxLifetime, metadataMimeType, or dataMimeType is nullIllegalArgumentException - if keepAliveInterval or maxLifetime is not a
positive durationpublic static SetupFrame createSetupFrame(ByteBufAllocator byteBufAllocator, boolean lease, int majorVersion, int minorVersion, Duration keepAliveInterval, Duration maxLifetime, @Nullable ByteBuf resumeIdentificationToken, String metadataMimeType, String dataMimeType, @Nullable ByteBuf metadata, @Nullable ByteBuf data)
SETUP frame.byteBufAllocator - the ByteBufAllocator to uselease - whether to set the Lease flagmajorVersion - the major version of the protocolminorVersion - the minor version of the protocolkeepAliveInterval - the time between KEEPALIVE framesmaxLifetime - the time between KEEPALIVE frames before the server is assumed to be
deadresumeIdentificationToken - the resume identification tokenmetadataMimeType - metadata MIME-type encodingdataMimeType - data MIME-type encodingmetadata - the metadatadata - the dataSETUP frameNullPointerException - if byteBufAllocator, keepAliveInterval, maxLifetime, metadataMimeType, or dataMimeType is nullIllegalArgumentException - if keepAliveInterval or maxLifetime is not a
positive durationpublic String getDataMimeType()
StandardCharsets.UTF_8.StandardCharsets.UTF_8public String getDataMimeType(Charset charset)
charset - the Charset to decode the data MIME-type withpublic Duration getKeepAliveInterval()
public int getMajorVersion()
public Duration getMaxLifetime()
public String getMetadataMimeType()
StandardCharsets.UTF_8.StandardCharsets.UTF_8public String getMetadataMimeType(Charset charset)
charset - the Charset to decode the metadata MIME-type withpublic int getMinorVersion()
public Optional<String> getResumeIdentificationTokenAsUtf8()
String. If the Resume Enabled flag
is not set, returns Optional.empty().Stringpublic ByteBuf getUnsafeData()
DataFrameNote: this data will be outside of the Frame's lifecycle and may be released
at any time. It is highly recommended that you ByteBuf.retain() the data if you store
it.
DataFrame.getDataAsUtf8(),
DataFrame.mapData(Function)@Nullable public ByteBuf getUnsafeMetadata()
MetadataFramenull.
Note: this metadata will be outside of the Frame's lifecycle and may be
released at any time. It is highly recommended that you ByteBuf.retain() the metadata
if you store it.
null if the Metadata flag is not setMetadataFrame.getMetadataAsUtf8(),
MetadataFrame.mapMetadata(Function)@Nullable public ByteBuf getUnsafeResumeIdentificationToken()
null.
Note: this resume identification token will be outside of the Frame's
lifecycle and may be released at any time. It is highly recommended that you ByteBuf.retain() the resume identification token if you store it.
null if the Resume Enabled flag is
not setmapResumeIdentificationToken(Function)@Nullable public String getUnsafeResumeIdentificationTokenAsUtf8()
String. If the Resume Enabled flag
is not set, returns null.String or null if the Resume
Enabled flag is not set.getResumeIdentificationTokenAsUtf8()public boolean isLeaseFlagSet()
public <T> Optional<T> mapResumeIdentificationToken(Function<ByteBuf,T> function)
Optional.empty().T - the different typefunction - the function to transform the resume identification token to a different typeNullPointerException - if function is nullpublic final void dispose()
dispose in interface Disposablepublic FrameType getFrameType()
FrameFrameType.getFrameType in interface FrameFrameTypepublic final ByteBuf getUnsafeFrame()
FrameNote: this frame will be outside of the Frame's lifecycle and may be released
at any time. It is highly recommended that you ByteBuf.retain() the frame if you store
it.
getUnsafeFrame in interface FrameFrame.consumeFrame(Consumer),
Frame.mapFrame(Function)