I just got burned by #16303. Answering https://github.com/akka/akka/issues/16303#issuecomment-62957914, it looks like `copyToArray[B >: Byte](Array[B])` can't call `getBytes(Array[Byte], Int, Int)` due to the type constraint (defined by `GenTraversableOnce`). Instead, I'm going with the simple `isEmpty` solution proposed in the description of #16303 by @kpatrick-kixeye.
This commit is contained in:
parent
d08ebf4552
commit
8286ecffc5
2 changed files with 12 additions and 1 deletions
|
|
@ -895,6 +895,15 @@ class ByteStringSpec extends WordSpec with Matchers with Checkers {
|
|||
bytes == array.toSeq
|
||||
}
|
||||
}
|
||||
|
||||
"copying chunks to an array" in {
|
||||
val iterator = (ByteString("123") ++ ByteString("456")).iterator
|
||||
val array = Array.ofDim[Byte](6)
|
||||
iterator.copyToArray(array, 0, 2)
|
||||
iterator.copyToArray(array, 2, 2)
|
||||
iterator.copyToArray(array, 4, 2)
|
||||
assert(new String(array) === "123456")
|
||||
}
|
||||
}
|
||||
|
||||
"decode data correctly" when {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue