Merge pull request #19802 from ktoso/wip-framing-made-proper-ktoso

!str split Framing into javadsl and scaladsl
This commit is contained in:
Konrad Malawski 2016-02-16 20:53:34 +01:00
commit 650e94ba30
15 changed files with 218 additions and 26 deletions

View file

@ -0,0 +1,29 @@
/**
* Copyright (C) 2015-2016 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.stream.javadsl;
import akka.NotUsed;
import akka.stream.StreamTest;
import akka.stream.testkit.AkkaSpec;
import akka.util.ByteString;
import org.junit.ClassRule;
import org.junit.Test;
public class FramingTest extends StreamTest {
public FramingTest() {
super(actorSystemResource);
}
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("FramingTest", AkkaSpec.testConf());
@Test
public void mustBeAbleToUseFraming() throws Exception {
final Source<ByteString, NotUsed> in = Source.single(ByteString.fromString("1,3,4,5"));
in.via(Framing.delimiter(ByteString.fromString(","), Integer.MAX_VALUE, FramingTruncation.ALLOW))
.runWith(Sink.ignore(), materializer);
}
}

View file

@ -1,15 +1,14 @@
/**
* Copyright (C) 2014-2016 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.stream.io
package akka.stream.scaladsl
import java.nio.ByteOrder
import akka.stream.io.Framing.FramingException
import akka.stream.{ ActorMaterializer, ActorMaterializerSettings }
import akka.stream.scaladsl._
import akka.stream.stage.{ TerminationDirective, SyncDirective, Context, PushPullStage }
import akka.stream.scaladsl.Framing.FramingException
import akka.stream.stage.{ Context, PushPullStage, SyncDirective, TerminationDirective }
import akka.stream.testkit.AkkaSpec
import akka.stream.{ ActorMaterializer, ActorMaterializerSettings }
import akka.util.{ ByteString, ByteStringBuilder }
import scala.collection.immutable