diff --git a/runtime/src/main/scala/org/apache/pekko/grpc/internal/ByteStringInputStream.scala b/runtime/src/main/scala/org/apache/pekko/grpc/internal/ByteStringInputStream.scala index 0122b040..ea239876 100644 --- a/runtime/src/main/scala/org/apache/pekko/grpc/internal/ByteStringInputStream.scala +++ b/runtime/src/main/scala/org/apache/pekko/grpc/internal/ByteStringInputStream.scala @@ -22,6 +22,7 @@ import org.apache.pekko import pekko.annotation.InternalApi import pekko.util.ByteString import pekko.util.ByteString.ByteString1C +import pekko.util.ByteString.ByteStrings /** INTERNAL API */ @InternalApi @@ -48,7 +49,7 @@ private[internal] object ByteStringInputStream { case bytestrings: ByteStrings => new SequenceInputStream(bytestrings.iterator.map(_.asInputStream).asJavaEnumeration) case _ => - new ByteArrayInputStream(bs.toArrayUnsafe()) + getInputStreamUnsafe(bs) } private def getInputStreamUnsafe(bs: ByteString): InputStream =