org.apache.spark.sql.types
Class UTF8String

Object
  extended by org.apache.spark.sql.types.UTF8String
All Implemented Interfaces:
java.io.Serializable, Comparable<UTF8String>, scala.math.Ordered<UTF8String>

public final class UTF8String
extends Object
implements scala.math.Ordered<UTF8String>, scala.Serializable

:: DeveloperApi :: A UTF-8 String, as internal representation of StringType in SparkSQL

A String encoded in UTF-8 as an Array[Byte], which can be used for comparison, search, see http://en.wikipedia.org/wiki/UTF-8 for details.

Note: This is not designed for general use cases, should not be used outside SQL.

See Also:
Serialized Form

Constructor Summary
UTF8String()
           
 
Method Summary
static UTF8String apply(byte[] bytes)
          Create a UTF-8 String from Array[Byte], which should be encoded in UTF-8
static UTF8String apply(String s)
          Create a UTF-8 String from String
static int[] bytesOfCodePointInUTF8()
           
 UTF8String clone()
           
 int compare(UTF8String other)
           
 int compareTo(UTF8String other)
           
 boolean contains(UTF8String sub)
           
 boolean endsWith(UTF8String suffix)
           
 boolean equals(Object other)
           
 byte[] getBytes()
           
 int hashCode()
           
 int length()
          Return the number of code points in it.
 UTF8String set(byte[] bytes)
          Update the UTF8String with Array[Byte], which should be encoded in UTF-8
 UTF8String set(String str)
          Update the UTF8String with String.
 UTF8String slice(int start, int until)
          Return a substring of this,
 boolean startsWith(UTF8String prefix)
           
 UTF8String toLowerCase()
           
 String toString()
           
 UTF8String toUpperCase()
           
 
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface scala.math.Ordered
$greater, $greater$eq, $less, $less$eq
 

Constructor Detail

UTF8String

public UTF8String()
Method Detail

bytesOfCodePointInUTF8

public static int[] bytesOfCodePointInUTF8()

apply

public static UTF8String apply(String s)
Create a UTF-8 String from String

Parameters:
s - (undocumented)
Returns:
(undocumented)

apply

public static UTF8String apply(byte[] bytes)
Create a UTF-8 String from Array[Byte], which should be encoded in UTF-8

Parameters:
bytes - (undocumented)
Returns:
(undocumented)

set

public UTF8String set(String str)
Update the UTF8String with String.

Parameters:
str - (undocumented)
Returns:
(undocumented)

set

public UTF8String set(byte[] bytes)
Update the UTF8String with Array[Byte], which should be encoded in UTF-8

Parameters:
bytes - (undocumented)
Returns:
(undocumented)

length

public int length()
Return the number of code points in it.

This is only used by Substring() when start is negative.

Returns:
(undocumented)

getBytes

public byte[] getBytes()

slice

public UTF8String slice(int start,
                        int until)
Return a substring of this,

Parameters:
start - the position of first code point
until - the position after last code point
Returns:
(undocumented)

contains

public boolean contains(UTF8String sub)

startsWith

public boolean startsWith(UTF8String prefix)

endsWith

public boolean endsWith(UTF8String suffix)

toUpperCase

public UTF8String toUpperCase()

toLowerCase

public UTF8String toLowerCase()

toString

public String toString()
Overrides:
toString in class Object

clone

public UTF8String clone()
Overrides:
clone in class Object

compare

public int compare(UTF8String other)
Specified by:
compare in interface scala.math.Ordered<UTF8String>

compareTo

public int compareTo(UTF8String other)
Specified by:
compareTo in interface Comparable<UTF8String>
Specified by:
compareTo in interface scala.math.Ordered<UTF8String>

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object