Class BufferUtils

java.lang.Object
me.hugmanrique.cartage.util.BufferUtils

public final class BufferUtils extends Object
Provides memory handling-related utilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    copyByteByByte​(byte[] arr, int srcPos, int destPos, int length)
    Copies the contents from the specified array byte-by-byte, beginning at the specified position, to the specified position of the array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • copyByteByByte

      public static void copyByteByByte(byte[] arr, int srcPos, int destPos, int length)
      Copies the contents from the specified array byte-by-byte, beginning at the specified position, to the specified position of the array. The source and destination areas may overlap: a copy operation observes the results of past copy operations (unlike System.arraycopy(Object, int, Object, int, int)).

      Fallbacks to System.arraycopy(Object, int, Object, int, int)

      if the source and destination ranges do not overlap.
      Parameters:
      arr - the source and destination array
      srcPos - the starting source position in the array
      destPos - the starting destination position in the array
      length - the number of array elements to copy