org.apache.accumulo.examples.wikisearch.util
Class TextUtil

java.lang.Object
  extended by org.apache.accumulo.examples.wikisearch.util.TextUtil

public class TextUtil
extends Object


Constructor Summary
TextUtil()
           
 
Method Summary
static void appendNullByte(org.apache.hadoop.io.Text text)
          Appends a null byte to the given text
static void textAppend(org.apache.hadoop.io.Text t, long s)
           
static void textAppend(org.apache.hadoop.io.Text text, String string)
          Appends a null byte followed by the UTF-8 bytes of the given string to the given Text
static void textAppend(org.apache.hadoop.io.Text text, String string, boolean replaceBadChar)
           
static void textAppendNoNull(org.apache.hadoop.io.Text t, String s)
          Appends the UTF-8 bytes of the given string to the given Text
static void textAppendNoNull(org.apache.hadoop.io.Text t, String s, boolean replaceBadChar)
          Appends the UTF-8 bytes of the given string to the given Text
static byte[] toUtf8(String string)
          Converts the given string its UTF-8 bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtil

public TextUtil()
Method Detail

textAppend

public static void textAppend(org.apache.hadoop.io.Text text,
                              String string)
Appends a null byte followed by the UTF-8 bytes of the given string to the given Text

Parameters:
text - the Text to which to append
string - the String to append

textAppend

public static void textAppend(org.apache.hadoop.io.Text text,
                              String string,
                              boolean replaceBadChar)

textAppend

public static void textAppend(org.apache.hadoop.io.Text t,
                              long s)

appendNullByte

public static void appendNullByte(org.apache.hadoop.io.Text text)
Appends a null byte to the given text

Parameters:
text - the text to which to append the null byte

textAppendNoNull

public static void textAppendNoNull(org.apache.hadoop.io.Text t,
                                    String s)
Appends the UTF-8 bytes of the given string to the given Text

Parameters:
t - the Text to which to append
s - the String to append

textAppendNoNull

public static void textAppendNoNull(org.apache.hadoop.io.Text t,
                                    String s,
                                    boolean replaceBadChar)
Appends the UTF-8 bytes of the given string to the given Text

Parameters:
t -
s -
replaceBadChar -

toUtf8

public static byte[] toUtf8(String string)
Converts the given string its UTF-8 bytes. This uses Hadoop's method for converting string to UTF-8 and is much faster than calling String.getBytes(String).

Parameters:
string - the string to convert
Returns:
the UTF-8 representation of the string


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.