org.gudy.azureus2.core3.util
Class StringInterner
java.lang.Object
org.gudy.azureus2.core3.util.StringInterner
public class StringInterner
- extends Object
Field Summary |
static boolean |
DISABLE_INTERNING
Can't be final as set true for a few specific apps |
Method Summary |
static String |
intern(byte[] bytes)
|
static char[] |
intern(char[] toIntern)
|
static String |
intern(String toIntern)
|
static byte[] |
internBytes(byte[] toIntern)
|
static File |
internFile(File toIntern)
This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths. |
static Object |
internObject(Object toIntern)
A generic interning facilty for heavyweight or frequently duplicated
Objects that have a reasonable equals() implementation.
Important: The objects should have a limited lifespan, the interning set
used by this method is unmanaged, i.e. |
static URL |
internURL(URL toIntern)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DISABLE_INTERNING
public static boolean DISABLE_INTERNING
- Can't be final as set true for a few specific apps
StringInterner
public StringInterner()
intern
public static String intern(byte[] bytes)
internObject
public static Object internObject(Object toIntern)
- A generic interning facilty for heavyweight or frequently duplicated
Objects that have a reasonable
equals()
implementation.
Important: The objects should have a limited lifespan, the interning set
used by this method is unmanaged, i.e. does not clean out old entries!
Entries without strong references are still removed.
intern
public static String intern(String toIntern)
intern
public static char[] intern(char[] toIntern)
internBytes
public static byte[] internBytes(byte[] toIntern)
internFile
public static File internFile(File toIntern)
- This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths.
Thus internFile should be used with canonized Files exclusively
internURL
public static URL internURL(URL toIntern)