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
public abstract class BinaryMessage extends Message
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 casegetStreamedData()
will return a Source streaming the data as it comes in.
-
-
Constructor Summary
Constructors Constructor Description BinaryMessage()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BinaryMessage
adapt(BinaryMessage msg)
BinaryMessage
asBinaryMessage()
Returns this BinaryMessage if it is a binary message, throws otherwise.abstract BinaryMessage
asScala()
TextMessage
asTextMessage()
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,?>
getStreamedData()
Returns a source of the binary message data.abstract akka.util.ByteString
getStrictData()
Returns the strict message data if this message is strict, throws otherwise.boolean
isText()
Is this message a text message?abstract java.util.concurrent.CompletionStage<BinaryMessage.Strict>
toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-
-
-
Method Detail
-
create
public static BinaryMessage create(akka.util.ByteString data)
Creates a strict binary message.- Parameters:
data
- (undocumented)- Returns:
- (undocumented)
-
create
public static BinaryMessage create(akka.stream.javadsl.Source<akka.util.ByteString,?> dataStream)
Creates a streamed binary message.- Parameters:
dataStream
- (undocumented)- Returns:
- (undocumented)
-
adapt
public static BinaryMessage adapt(BinaryMessage msg)
-
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
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 BinaryMessage asScala()
-
toStrict
public abstract java.util.concurrent.CompletionStage<BinaryMessage.Strict> toStrict(long timeoutMillis, akka.stream.Materializer materializer)
-
-