+act #19085 adds Java API ByteString#createBuilder
This commit is contained in:
parent
516b1f0954
commit
9abb1eaea6
3 changed files with 31 additions and 1 deletions
|
|
@ -1 +1 @@
|
|||
1.6
|
||||
1.8
|
||||
|
|
|
|||
27
akka-actor-tests/src/test/java/akka/util/ByteStringTest.java
Normal file
27
akka-actor-tests/src/test/java/akka/util/ByteStringTest.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.util;
|
||||
|
||||
import org.junit.Test;
|
||||
import scala.concurrent.duration.Duration;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
|
||||
public class ByteStringTest {
|
||||
|
||||
@Test
|
||||
public void testCreation() {
|
||||
final ByteString s1 = ByteString.fromString("");
|
||||
final ByteString s2 = ByteString.fromInts(1, 2, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuilderCreation() {
|
||||
final ByteStringBuilder sb = ByteString.createBuilder();
|
||||
sb.append(ByteString.fromString("Hello"));
|
||||
sb.append(ByteString.fromString("World"));
|
||||
assertEquals(ByteString.fromString("Hello World"), sb.result());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -93,6 +93,9 @@ object ByteString {
|
|||
|
||||
def newBuilder: ByteStringBuilder = new ByteStringBuilder
|
||||
|
||||
/** Java API */
|
||||
def createBuilder: ByteStringBuilder = new ByteStringBuilder
|
||||
|
||||
implicit val canBuildFrom: CanBuildFrom[TraversableOnce[Byte], Byte, ByteString] =
|
||||
new CanBuildFrom[TraversableOnce[Byte], Byte, ByteString] {
|
||||
def apply(ignore: TraversableOnce[Byte]): ByteStringBuilder = newBuilder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue