Class UTF8ByteArrayUtils

java.lang.Object
org.apache.hadoop.util.UTF8ByteArrayUtils

@Private @Unstable public class UTF8ByteArrayUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    findByte(byte[] utf, int start, int end, byte b)
    Find the first occurrence of the given byte b in a UTF-8 encoded string
    static int
    findBytes(byte[] utf, int start, int end, byte[] b)
    Find the first occurrence of the given bytes b in a UTF-8 encoded string
    static int
    findNthByte(byte[] utf, byte b, int n)
    Find the nth occurrence of the given byte b in a UTF-8 encoded string
    static int
    findNthByte(byte[] utf, int start, int length, byte b, int n)
    Find the nth occurrence of the given byte b in a UTF-8 encoded string

    Methods inherited from class java.lang.Object

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

    • UTF8ByteArrayUtils

      public UTF8ByteArrayUtils()
  • Method Details

    • findByte

      public static int findByte(byte[] utf, int start, int end, byte b)
      Find the first occurrence of the given byte b in a UTF-8 encoded string
      Parameters:
      utf - a byte array containing a UTF-8 encoded string
      start - starting offset
      end - ending position
      b - the byte to find
      Returns:
      position that first byte occurs, otherwise -1
    • findBytes

      public static int findBytes(byte[] utf, int start, int end, byte[] b)
      Find the first occurrence of the given bytes b in a UTF-8 encoded string
      Parameters:
      utf - a byte array containing a UTF-8 encoded string
      start - starting offset
      end - ending position
      b - the bytes to find
      Returns:
      position that first byte occurs, otherwise -1
    • findNthByte

      public static int findNthByte(byte[] utf, int start, int length, byte b, int n)
      Find the nth occurrence of the given byte b in a UTF-8 encoded string
      Parameters:
      utf - a byte array containing a UTF-8 encoded string
      start - starting offset
      length - the length of byte array
      b - the byte to find
      n - the desired occurrence of the given byte
      Returns:
      position that nth occurrence of the given byte if exists; otherwise -1
    • findNthByte

      public static int findNthByte(byte[] utf, byte b, int n)
      Find the nth occurrence of the given byte b in a UTF-8 encoded string
      Parameters:
      utf - a byte array containing a UTF-8 encoded string
      b - the byte to find
      n - the desired occurrence of the given byte
      Returns:
      position that nth occurrence of the given byte if exists; otherwise -1