Package akka.http.javadsl.model.ws
Class TextMessage
- java.lang.Object
-
- akka.http.javadsl.model.ws.Message
-
- akka.http.javadsl.model.ws.TextMessage
-
- Direct Known Subclasses:
TextMessage.Streamed
,TextMessage.Strict
public abstract class TextMessage extends Message
Represents a WebSocket text message. A text message can either be strict in which case the complete data is already available or it can be streamed in which casegetStreamedText()
will return a Source streaming the data as it comes in.
-
-
Constructor Summary
Constructors Constructor Description TextMessage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TextMessage
adapt(TextMessage msg)
BinaryMessage
asBinaryMessage()
Returns this BinaryMessage if it is a binary message, throws otherwise.abstract TextMessage
asScala()
TextMessage
asTextMessage()
Returns this TextMessage if it is a text message, throws otherwise.static TextMessage
create(akka.stream.javadsl.Source<java.lang.String,?> textStream)
Creates a streamed text message.static TextMessage
create(java.lang.String text)
Creates a strict text message.abstract akka.stream.javadsl.Source<java.lang.String,?>
getStreamedText()
Returns a source of the text message data.abstract java.lang.String
getStrictText()
Returns the strict message text if this message is strict, throws otherwise.boolean
isText()
Is this message a text message?abstract java.util.concurrent.CompletionStage<TextMessage.Strict>
toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-
-
-
Method Detail
-
create
public static TextMessage create(java.lang.String text)
Creates a strict text message.- Parameters:
text
- (undocumented)- Returns:
- (undocumented)
-
create
public static TextMessage create(akka.stream.javadsl.Source<java.lang.String,?> textStream)
Creates a streamed text message.- Parameters:
textStream
- (undocumented)- Returns:
- (undocumented)
-
adapt
public static TextMessage adapt(TextMessage msg)
-
getStreamedText
public abstract akka.stream.javadsl.Source<java.lang.String,?> getStreamedText()
Returns a source of the text message data.- Returns:
- (undocumented)
-
getStrictText
public abstract java.lang.String getStrictText()
Returns the strict message text if this message is strict, throws otherwise.- Returns:
- (undocumented)
-
isText
public boolean isText()
Description copied from class:Message
Is this message a text message? If true,Message.asTextMessage()
will return this text message, if false,Message.asBinaryMessage()
will return this binary message.
-
asTextMessage
public TextMessage asTextMessage()
Description copied from class:Message
Returns this TextMessage if it is a text message, throws otherwise.- Specified by:
asTextMessage
in classMessage
- Returns:
- (undocumented)
-
asBinaryMessage
public BinaryMessage asBinaryMessage()
Description copied from class:Message
Returns this BinaryMessage if it is a binary message, throws otherwise.- Specified by:
asBinaryMessage
in classMessage
- Returns:
- (undocumented)
-
asScala
public abstract TextMessage asScala()
-
toStrict
public abstract java.util.concurrent.CompletionStage<TextMessage.Strict> toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-
-