Class BytesUtils

java.lang.Object
org.bardframework.commons.utils.BytesUtils

public final class BytesUtils extends Object
Created by Vahid Zafari.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    indexOf(byte[] src, byte[] search)
    Returns the index within src of the first occurrence of the specified search bytes.
    static boolean
    isExist(byte[] src, byte[] search)
     
    static byte[]
    replace(byte[] src, byte[] find, byte[] replace)
    find and replace must have same size

    Methods inherited from class java.lang.Object

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

    • replace

      public static byte[] replace(byte[] src, byte[] find, byte[] replace)
      find and replace must have same size
      Returns:
      copy of src, replace bytes if found and possible
    • indexOf

      public static int indexOf(byte[] src, byte[] search)
      Returns the index within src of the first occurrence of the specified search bytes. If no such value of k exists, then -1 is returned.
      Parameters:
      search - the bytes to search for.
      Returns:
      the index of the first occurrence of the specified bytes, or -1 if there is no such occurrence.
    • isExist

      public static boolean isExist(byte[] src, byte[] search)
      Parameters:
      search - the bytes to search for.
      Returns:
      true if the specified bytes exist in src, or false if there is no such occurrence.