Record Class EncodedMessage
java.lang.Object
java.lang.Record
io.micronaut.servlet.websocket.EncodedMessage
- Record Components:
text- The text payload, ornullif this is a binary messagebinary- The binary payload, ornullif this is a text message
@Internal
public record EncodedMessage(@Nullable String text, @Nullable ByteBuffer binary)
extends Record
A message that has been encoded ready to be written to a Jakarta WebSocket remote
endpoint, as either a text or a binary frame.
- Since:
- 6.2.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsConstructorDescriptionEncodedMessage(@Nullable String text, @Nullable ByteBuffer binary) Creates an instance of aEncodedMessagerecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable ByteBufferbinary()Returns the value of thebinaryrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisText()static EncodedMessageofBinary(ByteBuffer binary) Creates a binary message.static EncodedMessageCreates a text message.@Nullable Stringtext()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
ofText
Creates a text message.- Parameters:
text- The text- Returns:
- The message
-
ofBinary
Creates a binary message.- Parameters:
binary- The payload- Returns:
- The message
-
isText
public boolean isText()- Returns:
- Whether this is a text message
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
text
-
binary
-