org.apache.lucene.util
Class StringHelper

java.lang.Object
  extended by org.apache.lucene.util.StringHelper

public abstract class StringHelper
extends Object

Methods for manipulating strings.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Field Summary
static StringInterner interner
          Expert: The StringInterner implementation used by Lucene.
 
Method Summary
static int bytesDifference(byte[] bytes1, int len1, byte[] bytes2, int len2)
          Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.
static Comparator<String> getVersionComparator()
           
static String intern(String s)
          Return the same string object for all equal strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interner

public static StringInterner interner
Expert: The StringInterner implementation used by Lucene. This shouldn't be changed to an incompatible implementation after other Lucene APIs have been used.

Method Detail

intern

public static String intern(String s)
Return the same string object for all equal strings


bytesDifference

public static final int bytesDifference(byte[] bytes1,
                                        int len1,
                                        byte[] bytes2,
                                        int len2)
Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.

Parameters:
bytes1 - The first byte[] to compare
bytes2 - The second byte[] to compare
Returns:
The number of common elements.

getVersionComparator

public static Comparator<String> getVersionComparator()
Returns:
a Comparator over versioned strings such as X.YY.Z
NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.