Module id.xfunction

Class ByteBufferUtils

Object
ByteBufferUtils

public class ByteBufferUtils extends Object
  • Constructor Details

    • ByteBufferUtils

      public ByteBufferUtils()
  • Method Details

    • copyToHead

      public ByteBuffer copyToHead(ByteBuffer buf, int start, int end)
      Copies portion of the buffer between [start, end) to the head of the ByteBuffer. The existing elements will be overwritten.
      Returns:
      same buf with position set to the length of the portion shifted
    • asBytes

      public byte[] asBytes(ByteBuffer data)
      If input ByteBuffer is direct (keeps data in native memory) it will copy all data to byte array (inside Java Heap) and return it. Otherwise it will return ByteBuffer.array()
    • asString

      public String asString(ByteBuffer byteBuffer)
      Return content of ByteBuffer as hexadecimal pairs string