org.apache.hadoop.util
Class UTF8ByteArrayUtils

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

public class UTF8ByteArrayUtils
extends Object


Constructor Summary
UTF8ByteArrayUtils()
           
 
Method Summary
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 Detail

UTF8ByteArrayUtils

public UTF8ByteArrayUtils()
Method Detail

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 occures 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 occures 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


Copyright © 2009 The Apache Software Foundation