Skip to content

Commit 8773ac1

Browse files
committed
Use toByteBufferUnsafe in toArraySlice
1 parent 11ffd3d commit 8773ac1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/shared/src/main/scala/fs2/Chunk.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,7 @@ object Chunk
10851085
def toByteVector() = bv
10861086

10871087
override def toArraySlice[O2 >: Byte](implicit ct: ClassTag[O2]): Chunk.ArraySlice[O2] =
1088-
if (ct.runtimeClass == classOf[Byte])
1089-
Chunk.ArraySlice[Byte](bv.toArrayUnsafe, 0, size).asInstanceOf[Chunk.ArraySlice[O2]]
1090-
else super.toArraySlice
1088+
Chunk.ByteBuffer(bv.toByteBufferUnsafe).toArraySlice
10911089

10921090
override def toByteBuffer[B >: Byte](implicit ev: B =:= Byte): JByteBuffer =
10931091
bv.toByteBuffer

0 commit comments

Comments
 (0)