This is an automated email from the ASF dual-hosted git repository.
engelen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
The following commit(s) were added to refs/heads/main by this push:
new 2ef115ea use ByString.toArrayUnsafe (#308)
2ef115ea is described below
commit 2ef115ea743b80339012a13d9cf4c0c85f642b96
Author: PJ Fanning <[email protected]>
AuthorDate: Sat May 18 11:15:25 2024 +0100
use ByString.toArrayUnsafe (#308)
---
runtime/src/main/scala/org/apache/pekko/grpc/internal/Gzip.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/src/main/scala/org/apache/pekko/grpc/internal/Gzip.scala
b/runtime/src/main/scala/org/apache/pekko/grpc/internal/Gzip.scala
index ce9aea0c..5b6dedbe 100644
--- a/runtime/src/main/scala/org/apache/pekko/grpc/internal/Gzip.scala
+++ b/runtime/src/main/scala/org/apache/pekko/grpc/internal/Gzip.scala
@@ -24,13 +24,13 @@ object Gzip extends Codec {
override def compress(uncompressed: ByteString): ByteString = {
val baos = new ByteArrayOutputStream(uncompressed.size)
val gzos = new GZIPOutputStream(baos)
- try gzos.write(uncompressed.toArray)
+ try gzos.write(uncompressed.toArrayUnsafe())
finally gzos.close()
ByteString.fromArrayUnsafe(baos.toByteArray)
}
override def uncompress(compressed: ByteString): ByteString = {
- val gzis = new GZIPInputStream(new
ByteArrayInputStream(compressed.toArray))
+ val gzis = new GZIPInputStream(new
ByteArrayInputStream(compressed.toArrayUnsafe()))
val baos = new ByteArrayOutputStream(compressed.size)
val buffer = new Array[Byte](32 * 1024)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]