Package akka.http.javadsl.model.ws
Class BinaryMessage
java.lang.Object
akka.http.javadsl.model.ws.Message
akka.http.javadsl.model.ws.BinaryMessage
- Direct Known Subclasses:
BinaryMessage.Streamed
,BinaryMessage.Strict
Represents a WebSocket binary message. A binary message can either be strict in which case
the complete data is already available or it can be streamed in which case
getStreamedData()
will return a Source streaming the data as it comes in.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BinaryMessage
adapt
(BinaryMessage msg) Returns this BinaryMessage if it is a binary message, throws otherwise.abstract BinaryMessage
asScala()
Returns this TextMessage if it is a text message, throws otherwise.static BinaryMessage
create
(akka.stream.javadsl.Source<akka.util.ByteString, ?> dataStream) Creates a streamed binary message.static BinaryMessage
create
(akka.util.ByteString data) Creates a strict binary message.abstract akka.stream.javadsl.Source<akka.util.ByteString,
?> Returns a source of the binary message data.abstract akka.util.ByteString
Returns the strict message data if this message is strict, throws otherwise.boolean
isText()
Is this message a text message?abstract CompletionStage<BinaryMessage.Strict>
toStrict
(long timeoutMillis, akka.stream.Materializer materializer)
-
Constructor Details
-
BinaryMessage
public BinaryMessage()
-
-
Method Details
-
create
Creates a strict binary message.- Parameters:
data
- (undocumented)- Returns:
- (undocumented)
-
create
Creates a streamed binary message.- Parameters:
dataStream
- (undocumented)- Returns:
- (undocumented)
-
adapt
-
getStreamedData
public abstract akka.stream.javadsl.Source<akka.util.ByteString,?> getStreamedData()Returns a source of the binary message data.- Returns:
- (undocumented)
-
getStrictData
public abstract akka.util.ByteString getStrictData()Returns the strict message data 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
Description copied from class:Message
Returns this TextMessage if it is a text message, throws otherwise.- Specified by:
asTextMessage
in classMessage
- Returns:
- (undocumented)
-
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
-
toStrict
public abstract CompletionStage<BinaryMessage.Strict> toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-