Class BytesUtils


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

      • 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.