是否可以加入 Akka 流源的元素?

Is it possible to join elements of an Akka Streams Source?

如果我有像他这样的消息来源:

val source = Source(List("hell", "o\n my ", "name is bob"))

是否可以在特定的分隔符模式上连接和重新拆分元素,例如在 '\n' 字符上得到类似的结果? :

Source(List("hello", "my name is bob"))

谢谢!

这可以使用 Framing 来完成:

source.via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 100, allowTruncation = true))