org.gudy.azureus2.core3.util
Class StringInterner
java.lang.Object
org.gudy.azureus2.core3.util.StringInterner
public class StringInterner
- extends java.lang.Object
Field Summary |
static boolean |
DISABLE_INTERNING
Can't be final as set true for a few specific apps |
Method Summary |
static java.lang.String |
intern(byte[] bytes)
|
static char[] |
intern(char[] toIntern)
|
static java.lang.String |
intern(java.lang.String toIntern)
|
static byte[] |
internBytes(byte[] toIntern)
|
static java.io.File |
internFile(java.io.File toIntern)
This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths. |
static java.lang.Object |
internObject(java.lang.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 java.net.URL |
internURL(java.net.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 java.lang.String intern(byte[] bytes)
internObject
public static java.lang.Object internObject(java.lang.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 java.lang.String intern(java.lang.String toIntern)
intern
public static char[] intern(char[] toIntern)
internBytes
public static byte[] internBytes(byte[] toIntern)
internFile
public static java.io.File internFile(java.io.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 java.net.URL internURL(java.net.URL toIntern)