Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private[coding] class DeflateCompressor private[coding] (compressionLevel: Int)

protected def compressWithBuffer(input: ByteString, buffer: Array[Byte]): ByteString = {
require(deflater.needsInput())
deflater.setInput(input.toArrayUnsafe())
deflater.setInput(input.asByteBuffer)
drainDeflater(deflater, buffer)
}
protected def flushWithBuffer(buffer: Array[Byte]): ByteString = {
Expand Down Expand Up @@ -149,7 +149,7 @@ private[coding] abstract class DeflateDecompressorBase(maxBytesPerChunk: Int = D

override def canWorkWithPartialData = true
override def parse(reader: ByteStringParser.ByteReader): ParseResult[ByteString] = {
inflater.setInput(reader.remainingData.toArray)
inflater.setInput(reader.remainingData.asByteBuffer)

val buffer = new Array[Byte](maxBytesPerChunk)
val read = inflater.inflate(buffer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private[coding] class GzipCompressor(compressionLevel: Int) extends DeflateCompr
header() ++ super.finishWithBuffer(buffer) ++ trailer()

private def updateCrc(input: ByteString): Unit = {
checkSum.update(input.toArrayUnsafe())
checkSum.update(input.asByteBuffer)
bytesRead += input.length
}
private def header(): ByteString =
Expand Down Expand Up @@ -117,7 +117,7 @@ private[coding] class GzipDecompressor(
}
private def crc16(data: ByteString) = {
val crc = new CRC32
crc.update(data.toArrayUnsafe())
crc.update(data.asByteBuffer)
crc.getValue.toInt & 0xFFFF
}
}
Expand Down
Loading