File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
core/shared/src/main/scala/fs2 Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -312,13 +312,15 @@ abstract class Chunk[+O] extends Serializable with ChunkPlatform[O] with ChunkRu
312312 case c : Chunk .ArraySlice [_] if c.values.isInstanceOf [Array [Byte ]] =>
313313 JByteBuffer .wrap(c.values.asInstanceOf [Array [Byte ]], c.offset, c.length)
314314 case c : Chunk .ByteBuffer =>
315- val b = c.buf.asReadOnlyBuffer
315+ val b = c.buf.duplicate // share contents, independent position/limit
316316 if (c.offset == 0 && b.position() == 0 && c.size == b.limit()) b
317317 else {
318318 (b : JBuffer ).position(c.offset.toInt)
319319 (b : JBuffer ).limit(c.offset.toInt + c.size)
320320 b
321321 }
322+ case c : Chunk .ByteVectorChunk =>
323+ c.bv.toByteBuffer
322324 case _ =>
323325 JByteBuffer .wrap(this .asInstanceOf [Chunk [Byte ]].toArray, 0 , size)
324326 }
You can’t perform that action at this time.
0 commit comments