All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.avro4s.avroutils.ByteBufferHelper.scala Maven / Gradle / Ivy

package com.sksamuel.avro4s.avroutils

import java.nio.ByteBuffer

private[avro4s] object ByteBufferHelper {
  def asArray(byteBuffer: ByteBuffer): Array[Byte] = {
    if (byteBuffer.hasArray) {
      byteBuffer.array()
    } else {
      val bytes = new Array[Byte](byteBuffer.remaining)
      byteBuffer.get(bytes)
      bytes
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy