Class Bytes


  • public class Bytes
    extends java.lang.Object
    Author:
    javaito
    • Constructor Summary

      Constructors 
      Constructor Description
      Bytes()  
    • Method Summary

      Modifier and Type Method Description
      static java.util.List<java.lang.Integer> allIndexOf​(byte[] value, byte[] key)
      Returns all the index into the array where start the key.
      static java.util.List<java.lang.Integer> allIndexOf​(byte[] value, byte[] key, int startIndex, int resultSize)
      Returns all the index into the array where start the key.
      static int indexOf​(byte[] value, byte[] key)
      Returns the first index into the array starting in the first element of the source array.
      static int indexOf​(byte[] value, byte[] key, int startIndex)
      Returns the first index into the array starting in the element indicated by the 'startIndex' parameter of the source array.
      static java.util.List<byte[]> split​(byte[] value, byte[] splitKey)
      Splits the byte array using the split key, and returns a list with the sub arrays products of the split.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Bytes

        public Bytes()
    • Method Detail

      • allIndexOf

        public static java.util.List<java.lang.Integer> allIndexOf​(byte[] value,
                                                                   byte[] key,
                                                                   int startIndex,
                                                                   int resultSize)
        Returns all the index into the array where start the key.
        Parameters:
        value - Array to find the indexes.
        key - Array that is the key to find the index.
        startIndex - Index to start the search.
        resultSize - Max size of the result, when the algorithm found this amount of indexes break the execution.
        Returns:
        List with all the indexes.
      • allIndexOf

        public static java.util.List<java.lang.Integer> allIndexOf​(byte[] value,
                                                                   byte[] key)
        Returns all the index into the array where start the key.
        Parameters:
        value - Array to find the indexes.
        key - Array that is the key to find the index.
        Returns:
        List with all the indexes.
      • indexOf

        public static int indexOf​(byte[] value,
                                  byte[] key)
        Returns the first index into the array starting in the first element of the source array.
        Parameters:
        value - Source array.
        key - Search key.
        Returns:
        First index into the source array.
      • indexOf

        public static int indexOf​(byte[] value,
                                  byte[] key,
                                  int startIndex)
        Returns the first index into the array starting in the element indicated by the 'startIndex' parameter of the source array.
        Parameters:
        value - Source array.
        key - Search key.
        startIndex - Element into the source array to start the search.
        Returns:
        First index into the source array.
      • split

        public static java.util.List<byte[]> split​(byte[] value,
                                                   byte[] splitKey)
        Splits the byte array using the split key, and returns a list with the sub arrays products of the split.
        Parameters:
        value - Byte array to split.
        splitKey - Byte array with the pattern to split.
        Returns:
        List with all the sub arrays.