Package org.apache.hadoop.util
Class UTF8ByteArrayUtils
java.lang.Object
org.apache.hadoop.util.UTF8ByteArrayUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intfindByte(byte[] utf, int start, int end, byte b) Find the first occurrence of the given byte b in a UTF-8 encoded stringstatic intfindBytes(byte[] utf, int start, int end, byte[] b) Find the first occurrence of the given bytes b in a UTF-8 encoded stringstatic intfindNthByte(byte[] utf, byte b, int n) Find the nth occurrence of the given byte b in a UTF-8 encoded stringstatic intfindNthByte(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
-
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 stringstart- starting offsetend- ending positionb- 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 stringstart- starting offsetend- ending positionb- 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 stringstart- starting offsetlength- the length of byte arrayb- the byte to findn- 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 stringb- the byte to findn- the desired occurrence of the given byte- Returns:
- position that nth occurrence of the given byte if exists; otherwise -1
-