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

im.actor.util.misc.ByteUtils.scala Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package im.actor.util.misc

import java.nio.ByteBuffer

object ByteUtils {
  private val buffer = ByteBuffer.allocate(java.lang.Long.BYTES);

  def longToBytes(x: Long) = {
    buffer.putLong(0, x)
    buffer.array()
  }

  def bytesToLong(bytes: Array[Byte]) = {
    buffer.put(bytes, 0, bytes.length)
    buffer.flip()
    buffer.getLong()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy